diff --git a/go.mod b/go.mod index 79fea434d89..fa9cd6d8c43 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/IBM-Cloud/terraform-provider-ibm go 1.16 require ( - github.com/IBM-Cloud/bluemix-go v0.0.0-20210811114147-998a1dd20356 + github.com/IBM-Cloud/bluemix-go v0.0.0-20210903091337-e7648c203ed5 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62 github.com/IBM-Cloud/power-go-client v1.0.55 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca diff --git a/go.sum b/go.sum index 8b7f277b900..cdd90886172 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/IBM-Cloud/bluemix-go v0.0.0-20210811114147-998a1dd20356 h1:/pq4mzvjZ4c7gGX+EIcjt6WOt8eNWXZjemDxcwFipn4= github.com/IBM-Cloud/bluemix-go v0.0.0-20210811114147-998a1dd20356/go.mod h1:xhNmnCQsgsDBOyqlfUuIQH6zFomHsqtJYmAmXFkQUwI= +github.com/IBM-Cloud/bluemix-go v0.0.0-20210902134055-e9cf0f844b53 h1:H5AFZHVfV5xD+RthlYhgl+fgN6t7qkJ7diJHsFBbEhY= +github.com/IBM-Cloud/bluemix-go v0.0.0-20210902134055-e9cf0f844b53/go.mod h1:q0fXFSbum/16D8Mgn1ROSfSyX4BmvBCm/hHdcXz0wCU= +github.com/IBM-Cloud/bluemix-go v0.0.0-20210903091337-e7648c203ed5 h1:bqcjvy0tnQjaNxFpg84aJiGF+jBnlEjC9zc2rmy8z+c= +github.com/IBM-Cloud/bluemix-go v0.0.0-20210903091337-e7648c203ed5/go.mod h1:q0fXFSbum/16D8Mgn1ROSfSyX4BmvBCm/hHdcXz0wCU= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62 h1:MOkcr6qQGk4tY542ZJ1DggVh2WUP72EEyLB79llFVH8= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= @@ -612,6 +616,7 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= diff --git a/ibm/resource_ibm_container_vpc_cluster.go b/ibm/resource_ibm_container_vpc_cluster.go index 61f569b483b..c05c3d725cd 100644 --- a/ibm/resource_ibm_container_vpc_cluster.go +++ b/ibm/resource_ibm_container_vpc_cluster.go @@ -1113,7 +1113,7 @@ func waitForVpcClusterMasterAvailable(d *schema.ResourceData, meta interface{}) clusterInfo, clusterInfoErr := csClient.Clusters().GetCluster(clusterID, targetEnv) if err != nil || clusterInfoErr != nil { - return clusterInfo, deployInProgress, err + return clusterInfo, deployInProgress, clusterInfoErr } if clusterInfo.Lifecycle.MasterStatus == ready { diff --git a/ibm/resource_ibm_ob_logging.go b/ibm/resource_ibm_ob_logging.go index 9e9cc4a23aa..7ae939010d6 100644 --- a/ibm/resource_ibm_ob_logging.go +++ b/ibm/resource_ibm_ob_logging.go @@ -39,7 +39,7 @@ func resourceIBMObLogging() *schema.Resource { Importer: &schema.ResourceImporter{}, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), + Create: schema.DefaultTimeout(45 * time.Minute), Update: schema.DefaultTimeout(10 * time.Minute), Delete: schema.DefaultTimeout(10 * time.Minute), }, @@ -116,6 +116,35 @@ func resourceIBMObLogging() *schema.Resource { }, } } +func waitForClusterIntegration(d *schema.ResourceData, meta interface{}, clusterID string) (interface{}, error) { + targetEnv, err := getVpcClusterTargetHeader(d, meta) + if err != nil { + return nil, err + } + csClient, err := meta.(ClientSession).VpcContainerAPI() + if err != nil { + return nil, err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{deployRequested, deployInProgress}, + Target: []string{ready}, + Refresh: func() (interface{}, string, error) { + clusterFields, err := csClient.Clusters().GetCluster(clusterID, targetEnv) + if err != nil { + return nil, "", fmt.Errorf("[ERROR] Error retrieving cluster: %s", err) + } + if clusterFields.Lifecycle.MasterStatus == ready || clusterFields.MasterStatus == ready { + return clusterFields, ready, nil + } + return clusterFields, deployInProgress, nil + }, + Timeout: d.Timeout(schema.TimeoutCreate), + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + return stateConf.WaitForState() +} func resourceIBMLoggingCreate(d *schema.ResourceData, meta interface{}) error { client, err := meta.(ClientSession).VpcContainerAPI() @@ -128,6 +157,11 @@ func resourceIBMLoggingCreate(d *schema.ResourceData, meta interface{}) error { //Read cluster ID and logging instanceID clusterName := d.Get(obLoggingCluster).(string) + _, err = waitForClusterIntegration(d, meta, clusterName) + if err != nil { + return fmt.Errorf("[ERROR] Error waiting for master node to be availabe before integrating Logging Instance: %s", err) + } + loggingInstanceID := d.Get(obLoggingInstanceID).(string) //Read Ingestionkey diff --git a/ibm/resource_ibm_ob_monitoring.go b/ibm/resource_ibm_ob_monitoring.go index fd42a92cfdf..deadd2dae85 100644 --- a/ibm/resource_ibm_ob_monitoring.go +++ b/ibm/resource_ibm_ob_monitoring.go @@ -39,7 +39,7 @@ func resourceIBMObMonitoring() *schema.Resource { Importer: &schema.ResourceImporter{}, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), + Create: schema.DefaultTimeout(45 * time.Minute), Update: schema.DefaultTimeout(10 * time.Minute), Delete: schema.DefaultTimeout(10 * time.Minute), }, @@ -129,6 +129,10 @@ func resourceIBMMonitoringCreate(d *schema.ResourceData, meta interface{}) error //Read cluster ID and sysdif instanceID clusterName := d.Get(obMonitoringCluster).(string) + _, err = waitForClusterIntegration(d, meta, clusterName) + if err != nil { + return fmt.Errorf("[ERROR] Error waiting for master node to be availabe before integrating Monitoring Instance: %s", err) + } sysdigInstanceID := d.Get(obMonitoringInstanceID).(string) //Read Ingestionkey diff --git a/website/docs/r/ob_logging.html.markdown b/website/docs/r/ob_logging.html.markdown index d1f6161d75b..7e9a34cd2a9 100644 --- a/website/docs/r/ob_logging.html.markdown +++ b/website/docs/r/ob_logging.html.markdown @@ -57,7 +57,7 @@ resource "ibm_ob_logging" "test2" { The `ibm_ob_logging` provides the following [Timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: -- **create**: The enablement of the feature is considered `failed` if no response is received for 10 minutes. +- **create**: The enablement of the feature is considered `failed` if no response is received for 45 minutes. - **delete**: The delete of the feature is considered `failed` if no response is received for 10 minutes. - **update**: The update of the feature is considered `failed` if no response is received for 10 minutes. diff --git a/website/docs/r/ob_monitoring.html.markdown b/website/docs/r/ob_monitoring.html.markdown index b80b163272b..66be8923bda 100644 --- a/website/docs/r/ob_monitoring.html.markdown +++ b/website/docs/r/ob_monitoring.html.markdown @@ -57,7 +57,7 @@ resource "ibm_ob_monitoring" "test2" { ibm_ob_monitoring provides the following [Timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: -- **create**: The enablement of the feature is considered `failed` if no response is received for 10 minutes. +- **create**: The enablement of the feature is considered `failed` if no response is received for 45 minutes. - **delete**: The delete of the feature is considered `failed` if no response is received for 10 minutes. - **update**: The update of the feature is considered `failed` if no response is received for 10 minutes.