diff --git a/google-beta/cloudrun_polling.go b/google-beta/cloudrun_polling.go new file mode 100644 index 0000000000..4750183d41 --- /dev/null +++ b/google-beta/cloudrun_polling.go @@ -0,0 +1,116 @@ +package google + +import ( + "errors" + "fmt" + + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +const readyStatus string = "Ready" + +type Condition struct { + Type string + Status string + Reason string + Message string +} + +// KnativeStatus is a struct that can contain a Knative style resource's Status block. It is not +// intended to be used for anything other than polling for the success of the given resource. +type KnativeStatus struct { + Metadata struct { + Name string + Namespace string + SelfLink string + } + Status struct { + Conditions []Condition + } +} + +// ConditionByType is a helper method for extracting a given condition +func (s KnativeStatus) ConditionByType(typ string) *Condition { + for _, condition := range s.Status.Conditions { + if condition.Type == typ { + c := condition + return &c + } + } + return nil +} + +// LatestMessage will return a human consumable status of the resource. This can +// be used to determine the human actionable error the GET doesn't return an explicit +// error but the resource is in an error state. +func (s KnativeStatus) LatestMessage() string { + c := s.ConditionByType(readyStatus) + if c != nil { + return fmt.Sprintf("%s - %s", c.Reason, c.Message) + } + + return "" +} + +// State will return a string representing the status of the Ready condition. +// No other conditions are currently returned as part of the state. +func (s KnativeStatus) State(res interface{}) string { + for _, condition := range s.Status.Conditions { + if condition.Type == "Ready" { + return fmt.Sprintf("%s:%s", condition.Type, condition.Status) + } + } + return "Empty" +} + +// CloudRunPolling allows for polling against a cloud run resource that implements the +// Kubernetes style status schema. +type CloudRunPolling struct { + Config *Config + WaitURL string +} + +func (p *CloudRunPolling) PendingStates() []string { + return []string{"Ready:Unknown", "Empty"} +} +func (p *CloudRunPolling) TargetStates() []string { + return []string{"Ready:True"} +} +func (p *CloudRunPolling) ErrorStates() []string { + return []string{"Ready:False"} +} + +func cloudRunPollingWaitTime(config *Config, res map[string]interface{}, project, url, activity string, timeoutMinutes int) error { + w := &CloudRunPolling{} + + scc := &resource.StateChangeConf{ + Pending: w.PendingStates(), + Target: w.TargetStates(), + Refresh: func() (interface{}, string, error) { + res, err := sendRequest(config, "GET", project, url, nil) + if err != nil { + return res, "", err + } + + status := KnativeStatus{} + err = Convert(res, &status) + if err != nil { + return res, "", err + } + + for _, errState := range w.ErrorStates() { + if status.State(res) == errState { + err = errors.New(status.LatestMessage()) + } + } + + return res, status.State(res), err + }, + Timeout: time.Duration(timeoutMinutes) * time.Minute, + } + + _, err := scc.WaitForState() + return err +} diff --git a/google-beta/resource_access_context_manager_access_level.go b/google-beta/resource_access_context_manager_access_level.go index ae19a318ec..17eabaedc1 100644 --- a/google-beta/resource_access_context_manager_access_level.go +++ b/google-beta/resource_access_context_manager_access_level.go @@ -279,14 +279,14 @@ func resourceAccessContextManagerAccessLevelCreate(d *schema.ResourceData, meta } d.SetId(id) - waitErr := accessContextManagerOperationWaitTime( + err = accessContextManagerOperationWaitTime( config, res, "Creating AccessLevel", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create AccessLevel: %s", waitErr) + return fmt.Errorf("Error waiting to create AccessLevel: %s", err) } log.Printf("[DEBUG] Finished creating AccessLevel %q: %#v", d.Id(), res) diff --git a/google-beta/resource_access_context_manager_access_policy.go b/google-beta/resource_access_context_manager_access_policy.go index e3a5f339ab..fb3fbe3af1 100644 --- a/google-beta/resource_access_context_manager_access_policy.go +++ b/google-beta/resource_access_context_manager_access_policy.go @@ -108,14 +108,14 @@ func resourceAccessContextManagerAccessPolicyCreate(d *schema.ResourceData, meta } d.SetId(id) - waitErr := accessContextManagerOperationWaitTime( + err = accessContextManagerOperationWaitTime( config, res, "Creating AccessPolicy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create AccessPolicy: %s", waitErr) + return fmt.Errorf("Error waiting to create AccessPolicy: %s", err) } log.Printf("[DEBUG] Finished creating AccessPolicy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_access_context_manager_service_perimeter.go b/google-beta/resource_access_context_manager_service_perimeter.go index 08423aabf4..9f91c189d9 100644 --- a/google-beta/resource_access_context_manager_service_perimeter.go +++ b/google-beta/resource_access_context_manager_service_perimeter.go @@ -224,14 +224,14 @@ func resourceAccessContextManagerServicePerimeterCreate(d *schema.ResourceData, } d.SetId(id) - waitErr := accessContextManagerOperationWaitTime( + err = accessContextManagerOperationWaitTime( config, res, "Creating ServicePerimeter", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ServicePerimeter: %s", waitErr) + return fmt.Errorf("Error waiting to create ServicePerimeter: %s", err) } log.Printf("[DEBUG] Finished creating ServicePerimeter %q: %#v", d.Id(), res) diff --git a/google-beta/resource_app_engine_application_url_dispatch_rules.go b/google-beta/resource_app_engine_application_url_dispatch_rules.go index 6322689966..9e7c2dcd29 100644 --- a/google-beta/resource_app_engine_application_url_dispatch_rules.go +++ b/google-beta/resource_app_engine_application_url_dispatch_rules.go @@ -119,14 +119,14 @@ func resourceAppEngineApplicationUrlDispatchRulesCreate(d *schema.ResourceData, } d.SetId(id) - waitErr := appEngineOperationWaitTime( + err = appEngineOperationWaitTime( config, res, project, "Creating ApplicationUrlDispatchRules", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ApplicationUrlDispatchRules: %s", waitErr) + return fmt.Errorf("Error waiting to create ApplicationUrlDispatchRules: %s", err) } log.Printf("[DEBUG] Finished creating ApplicationUrlDispatchRules %q: %#v", d.Id(), res) diff --git a/google-beta/resource_app_engine_domain_mapping.go b/google-beta/resource_app_engine_domain_mapping.go index 9ee1de2e5f..a555c3b9cb 100644 --- a/google-beta/resource_app_engine_domain_mapping.go +++ b/google-beta/resource_app_engine_domain_mapping.go @@ -189,14 +189,14 @@ func resourceAppEngineDomainMappingCreate(d *schema.ResourceData, meta interface } d.SetId(id) - waitErr := appEngineOperationWaitTime( + err = appEngineOperationWaitTime( config, res, project, "Creating DomainMapping", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create DomainMapping: %s", waitErr) + return fmt.Errorf("Error waiting to create DomainMapping: %s", err) } log.Printf("[DEBUG] Finished creating DomainMapping %q: %#v", d.Id(), res) diff --git a/google-beta/resource_app_engine_standard_app_version.go b/google-beta/resource_app_engine_standard_app_version.go index ec61a5edf4..e999011e7b 100644 --- a/google-beta/resource_app_engine_standard_app_version.go +++ b/google-beta/resource_app_engine_standard_app_version.go @@ -397,14 +397,14 @@ func resourceAppEngineStandardAppVersionCreate(d *schema.ResourceData, meta inte } d.SetId(id) - waitErr := appEngineOperationWaitTime( + err = appEngineOperationWaitTime( config, res, project, "Creating StandardAppVersion", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create StandardAppVersion: %s", waitErr) + return fmt.Errorf("Error waiting to create StandardAppVersion: %s", err) } log.Printf("[DEBUG] Finished creating StandardAppVersion %q: %#v", d.Id(), res) diff --git a/google-beta/resource_cloud_run_service.go b/google-beta/resource_cloud_run_service.go index ce5934d1fe..b633661462 100644 --- a/google-beta/resource_cloud_run_service.go +++ b/google-beta/resource_cloud_run_service.go @@ -36,8 +36,8 @@ func resourceCloudRunService() *schema.Resource { }, Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(4 * time.Minute), - Update: schema.DefaultTimeout(4 * time.Minute), + Create: schema.DefaultTimeout(6 * time.Minute), + Update: schema.DefaultTimeout(6 * time.Minute), Delete: schema.DefaultTimeout(4 * time.Minute), }, @@ -614,6 +614,19 @@ func resourceCloudRunServiceCreate(d *schema.ResourceData, meta interface{}) err } d.SetId(id) + waitURL, err := replaceVars(d, config, "{{CloudRunBasePath}}serving.knative.dev/v1/namespaces/{{project}}/services/{{name}}") + if err != nil { + return err + } + + err = cloudRunPollingWaitTime( + config, res, project, waitURL, "Creating Service", + int(d.Timeout(schema.TimeoutCreate).Minutes())) + + if err != nil { + return fmt.Errorf("Error waiting to create Service: %s", err) + } + log.Printf("[DEBUG] Finished creating Service %q: %#v", d.Id(), res) return resourceCloudRunServiceRead(d, meta) @@ -705,12 +718,25 @@ func resourceCloudRunServiceUpdate(d *schema.ResourceData, meta interface{}) err } log.Printf("[DEBUG] Updating Service %q: %#v", d.Id(), obj) - _, err = sendRequestWithTimeout(config, "PUT", project, url, obj, d.Timeout(schema.TimeoutUpdate)) + res, err := sendRequestWithTimeout(config, "PUT", project, url, obj, d.Timeout(schema.TimeoutUpdate)) if err != nil { return fmt.Errorf("Error updating Service %q: %s", d.Id(), err) } + waitURL, err := replaceVars(d, config, "{{CloudRunBasePath}}serving.knative.dev/v1/namespaces/{{project}}/services/{{name}}") + if err != nil { + return err + } + + err = cloudRunPollingWaitTime( + config, res, project, waitURL, "Updating Service", + int(d.Timeout(schema.TimeoutUpdate).Minutes())) + + if err != nil { + return err + } + return resourceCloudRunServiceRead(d, meta) } diff --git a/google-beta/resource_cloud_run_service_generated_test.go b/google-beta/resource_cloud_run_service_generated_test.go new file mode 100644 index 0000000000..1e8eb3dd1d --- /dev/null +++ b/google-beta/resource_cloud_run_service_generated_test.go @@ -0,0 +1,101 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" +) + +func TestAccCloudRunService_cloudRunServiceBasicExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "namespace": getTestProjectFromEnv(), + "random_suffix": acctest.RandString(10), + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckCloudRunServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCloudRunService_cloudRunServiceBasicExample(context), + }, + { + ResourceName: "google_cloud_run_service.default", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCloudRunService_cloudRunServiceBasicExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_cloud_run_service" "default" { + name = "tftest-cloudrun%{random_suffix}" + location = "us-central1" + + metadata { + namespace = "%{namespace}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + } + } + } + + traffic { + percent = 100 + latest_revision = true + } +} +`, context) +} + +func testAccCheckCloudRunServiceDestroy(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_cloud_run_service" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := testAccProvider.Meta().(*Config) + + url, err := replaceVarsForTest(config, rs, "{{CloudRunBasePath}}serving.knative.dev/v1/namespaces/{{project}}/services/{{name}}") + if err != nil { + return err + } + + _, err = sendRequest(config, "GET", "", url, nil) + if err == nil { + return fmt.Errorf("CloudRunService still exists at %s", url) + } + } + + return nil +} diff --git a/google-beta/resource_compute_address.go b/google-beta/resource_compute_address.go index 2ba3d270d3..5ab3cd9695 100644 --- a/google-beta/resource_compute_address.go +++ b/google-beta/resource_compute_address.go @@ -247,14 +247,14 @@ func resourceComputeAddressCreate(d *schema.ResourceData, meta interface{}) erro } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Address", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Address: %s", waitErr) + return fmt.Errorf("Error waiting to create Address: %s", err) } log.Printf("[DEBUG] Finished creating Address %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_autoscaler.go b/google-beta/resource_compute_autoscaler.go index a5c3cd29f2..4bc79c9b91 100644 --- a/google-beta/resource_compute_autoscaler.go +++ b/google-beta/resource_compute_autoscaler.go @@ -338,14 +338,14 @@ func resourceComputeAutoscalerCreate(d *schema.ResourceData, meta interface{}) e } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Autoscaler", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Autoscaler: %s", waitErr) + return fmt.Errorf("Error waiting to create Autoscaler: %s", err) } log.Printf("[DEBUG] Finished creating Autoscaler %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_backend_bucket.go b/google-beta/resource_compute_backend_bucket.go index a574747a07..451b166723 100644 --- a/google-beta/resource_compute_backend_bucket.go +++ b/google-beta/resource_compute_backend_bucket.go @@ -170,14 +170,14 @@ func resourceComputeBackendBucketCreate(d *schema.ResourceData, meta interface{} } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating BackendBucket", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create BackendBucket: %s", waitErr) + return fmt.Errorf("Error waiting to create BackendBucket: %s", err) } log.Printf("[DEBUG] Finished creating BackendBucket %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_backend_bucket_signed_url_key.go b/google-beta/resource_compute_backend_bucket_signed_url_key.go index 8354161e77..53b77e84e3 100644 --- a/google-beta/resource_compute_backend_bucket_signed_url_key.go +++ b/google-beta/resource_compute_backend_bucket_signed_url_key.go @@ -119,14 +119,14 @@ func resourceComputeBackendBucketSignedUrlKeyCreate(d *schema.ResourceData, meta } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating BackendBucketSignedUrlKey", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create BackendBucketSignedUrlKey: %s", waitErr) + return fmt.Errorf("Error waiting to create BackendBucketSignedUrlKey: %s", err) } log.Printf("[DEBUG] Finished creating BackendBucketSignedUrlKey %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_backend_service.go b/google-beta/resource_compute_backend_service.go index 516142e265..da0b33cd96 100644 --- a/google-beta/resource_compute_backend_service.go +++ b/google-beta/resource_compute_backend_service.go @@ -1091,14 +1091,14 @@ func resourceComputeBackendServiceCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating BackendService", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create BackendService: %s", waitErr) + return fmt.Errorf("Error waiting to create BackendService: %s", err) } log.Printf("[DEBUG] Finished creating BackendService %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_backend_service_signed_url_key.go b/google-beta/resource_compute_backend_service_signed_url_key.go index cd8d0e33fb..e421aeb0b0 100644 --- a/google-beta/resource_compute_backend_service_signed_url_key.go +++ b/google-beta/resource_compute_backend_service_signed_url_key.go @@ -119,14 +119,14 @@ func resourceComputeBackendServiceSignedUrlKeyCreate(d *schema.ResourceData, met } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating BackendServiceSignedUrlKey", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create BackendServiceSignedUrlKey: %s", waitErr) + return fmt.Errorf("Error waiting to create BackendServiceSignedUrlKey: %s", err) } log.Printf("[DEBUG] Finished creating BackendServiceSignedUrlKey %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_disk.go b/google-beta/resource_compute_disk.go index 0e28e3a45b..6d631f2728 100644 --- a/google-beta/resource_compute_disk.go +++ b/google-beta/resource_compute_disk.go @@ -646,14 +646,14 @@ func resourceComputeDiskCreate(d *schema.ResourceData, meta interface{}) error { } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Disk", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Disk: %s", waitErr) + return fmt.Errorf("Error waiting to create Disk: %s", err) } log.Printf("[DEBUG] Finished creating Disk %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_disk_resource_policy_attachment.go b/google-beta/resource_compute_disk_resource_policy_attachment.go index 998a73755c..0cbb81862f 100644 --- a/google-beta/resource_compute_disk_resource_policy_attachment.go +++ b/google-beta/resource_compute_disk_resource_policy_attachment.go @@ -109,14 +109,14 @@ func resourceComputeDiskResourcePolicyAttachmentCreate(d *schema.ResourceData, m } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating DiskResourcePolicyAttachment", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create DiskResourcePolicyAttachment: %s", waitErr) + return fmt.Errorf("Error waiting to create DiskResourcePolicyAttachment: %s", err) } log.Printf("[DEBUG] Finished creating DiskResourcePolicyAttachment %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_external_vpn_gateway.go b/google-beta/resource_compute_external_vpn_gateway.go index 83ee318206..cd0e0515ce 100644 --- a/google-beta/resource_compute_external_vpn_gateway.go +++ b/google-beta/resource_compute_external_vpn_gateway.go @@ -160,14 +160,14 @@ func resourceComputeExternalVpnGatewayCreate(d *schema.ResourceData, meta interf } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating ExternalVpnGateway", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ExternalVpnGateway: %s", waitErr) + return fmt.Errorf("Error waiting to create ExternalVpnGateway: %s", err) } log.Printf("[DEBUG] Finished creating ExternalVpnGateway %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_firewall.go b/google-beta/resource_compute_firewall.go index 9796083743..adbde0c2f6 100644 --- a/google-beta/resource_compute_firewall.go +++ b/google-beta/resource_compute_firewall.go @@ -454,14 +454,14 @@ func resourceComputeFirewallCreate(d *schema.ResourceData, meta interface{}) err } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Firewall", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Firewall: %s", waitErr) + return fmt.Errorf("Error waiting to create Firewall: %s", err) } log.Printf("[DEBUG] Finished creating Firewall %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_forwarding_rule.go b/google-beta/resource_compute_forwarding_rule.go index e33c0678b3..32a44ca38e 100644 --- a/google-beta/resource_compute_forwarding_rule.go +++ b/google-beta/resource_compute_forwarding_rule.go @@ -424,14 +424,14 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating ForwardingRule", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ForwardingRule: %s", waitErr) + return fmt.Errorf("Error waiting to create ForwardingRule: %s", err) } log.Printf("[DEBUG] Finished creating ForwardingRule %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_global_address.go b/google-beta/resource_compute_global_address.go index b79acdc053..fdb24dcb26 100644 --- a/google-beta/resource_compute_global_address.go +++ b/google-beta/resource_compute_global_address.go @@ -240,14 +240,14 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{} } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating GlobalAddress", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create GlobalAddress: %s", waitErr) + return fmt.Errorf("Error waiting to create GlobalAddress: %s", err) } log.Printf("[DEBUG] Finished creating GlobalAddress %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_global_forwarding_rule.go b/google-beta/resource_compute_global_forwarding_rule.go index 765d4fdb5f..af9edbb9e5 100644 --- a/google-beta/resource_compute_global_forwarding_rule.go +++ b/google-beta/resource_compute_global_forwarding_rule.go @@ -365,14 +365,14 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating GlobalForwardingRule", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create GlobalForwardingRule: %s", waitErr) + return fmt.Errorf("Error waiting to create GlobalForwardingRule: %s", err) } log.Printf("[DEBUG] Finished creating GlobalForwardingRule %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_ha_vpn_gateway.go b/google-beta/resource_compute_ha_vpn_gateway.go index f6f33cd40d..de0e87955e 100644 --- a/google-beta/resource_compute_ha_vpn_gateway.go +++ b/google-beta/resource_compute_ha_vpn_gateway.go @@ -158,14 +158,14 @@ func resourceComputeHaVpnGatewayCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating HaVpnGateway", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create HaVpnGateway: %s", waitErr) + return fmt.Errorf("Error waiting to create HaVpnGateway: %s", err) } log.Printf("[DEBUG] Finished creating HaVpnGateway %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_health_check.go b/google-beta/resource_compute_health_check.go index 0c97db3d3f..67b4bf8568 100644 --- a/google-beta/resource_compute_health_check.go +++ b/google-beta/resource_compute_health_check.go @@ -678,14 +678,14 @@ func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating HealthCheck", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create HealthCheck: %s", waitErr) + return fmt.Errorf("Error waiting to create HealthCheck: %s", err) } log.Printf("[DEBUG] Finished creating HealthCheck %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_http_health_check.go b/google-beta/resource_compute_http_health_check.go index d8b1a9dcf1..0f05ea9cda 100644 --- a/google-beta/resource_compute_http_health_check.go +++ b/google-beta/resource_compute_http_health_check.go @@ -210,14 +210,14 @@ func resourceComputeHttpHealthCheckCreate(d *schema.ResourceData, meta interface } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating HttpHealthCheck", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create HttpHealthCheck: %s", waitErr) + return fmt.Errorf("Error waiting to create HttpHealthCheck: %s", err) } log.Printf("[DEBUG] Finished creating HttpHealthCheck %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_https_health_check.go b/google-beta/resource_compute_https_health_check.go index 8d6b68e417..7c2557a740 100644 --- a/google-beta/resource_compute_https_health_check.go +++ b/google-beta/resource_compute_https_health_check.go @@ -210,14 +210,14 @@ func resourceComputeHttpsHealthCheckCreate(d *schema.ResourceData, meta interfac } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating HttpsHealthCheck", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create HttpsHealthCheck: %s", waitErr) + return fmt.Errorf("Error waiting to create HttpsHealthCheck: %s", err) } log.Printf("[DEBUG] Finished creating HttpsHealthCheck %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_image.go b/google-beta/resource_compute_image.go index 2ea2c60b18..18055f131f 100644 --- a/google-beta/resource_compute_image.go +++ b/google-beta/resource_compute_image.go @@ -284,14 +284,14 @@ func resourceComputeImageCreate(d *schema.ResourceData, meta interface{}) error } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Image", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Image: %s", waitErr) + return fmt.Errorf("Error waiting to create Image: %s", err) } log.Printf("[DEBUG] Finished creating Image %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_interconnect_attachment.go b/google-beta/resource_compute_interconnect_attachment.go index 7a0496b0be..42c94e5b51 100644 --- a/google-beta/resource_compute_interconnect_attachment.go +++ b/google-beta/resource_compute_interconnect_attachment.go @@ -314,14 +314,14 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating InterconnectAttachment", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create InterconnectAttachment: %s", waitErr) + return fmt.Errorf("Error waiting to create InterconnectAttachment: %s", err) } log.Printf("[DEBUG] Finished creating InterconnectAttachment %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_managed_ssl_certificate.go b/google-beta/resource_compute_managed_ssl_certificate.go index d282c50616..0281ab2e5d 100644 --- a/google-beta/resource_compute_managed_ssl_certificate.go +++ b/google-beta/resource_compute_managed_ssl_certificate.go @@ -184,14 +184,14 @@ func resourceComputeManagedSslCertificateCreate(d *schema.ResourceData, meta int } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating ManagedSslCertificate", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ManagedSslCertificate: %s", waitErr) + return fmt.Errorf("Error waiting to create ManagedSslCertificate: %s", err) } log.Printf("[DEBUG] Finished creating ManagedSslCertificate %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_network.go b/google-beta/resource_compute_network.go index b2a97a04b3..1b3e91c036 100644 --- a/google-beta/resource_compute_network.go +++ b/google-beta/resource_compute_network.go @@ -166,14 +166,14 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Network", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Network: %s", waitErr) + return fmt.Errorf("Error waiting to create Network: %s", err) } log.Printf("[DEBUG] Finished creating Network %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_network_endpoint.go b/google-beta/resource_compute_network_endpoint.go index a7329f3003..501f648dc3 100644 --- a/google-beta/resource_compute_network_endpoint.go +++ b/google-beta/resource_compute_network_endpoint.go @@ -144,14 +144,14 @@ func resourceComputeNetworkEndpointCreate(d *schema.ResourceData, meta interface } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating NetworkEndpoint", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create NetworkEndpoint: %s", waitErr) + return fmt.Errorf("Error waiting to create NetworkEndpoint: %s", err) } log.Printf("[DEBUG] Finished creating NetworkEndpoint %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_network_endpoint_group.go b/google-beta/resource_compute_network_endpoint_group.go index 1fe84594cf..5e4f4cf3b5 100644 --- a/google-beta/resource_compute_network_endpoint_group.go +++ b/google-beta/resource_compute_network_endpoint_group.go @@ -188,14 +188,14 @@ func resourceComputeNetworkEndpointGroupCreate(d *schema.ResourceData, meta inte } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating NetworkEndpointGroup", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create NetworkEndpointGroup: %s", waitErr) + return fmt.Errorf("Error waiting to create NetworkEndpointGroup: %s", err) } log.Printf("[DEBUG] Finished creating NetworkEndpointGroup %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_node_group.go b/google-beta/resource_compute_node_group.go index 0638db7997..bc7b2ead9d 100644 --- a/google-beta/resource_compute_node_group.go +++ b/google-beta/resource_compute_node_group.go @@ -150,14 +150,14 @@ func resourceComputeNodeGroupCreate(d *schema.ResourceData, meta interface{}) er } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating NodeGroup", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create NodeGroup: %s", waitErr) + return fmt.Errorf("Error waiting to create NodeGroup: %s", err) } log.Printf("[DEBUG] Finished creating NodeGroup %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_node_template.go b/google-beta/resource_compute_node_template.go index d24c070b61..9617e493b8 100644 --- a/google-beta/resource_compute_node_template.go +++ b/google-beta/resource_compute_node_template.go @@ -230,14 +230,14 @@ func resourceComputeNodeTemplateCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating NodeTemplate", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create NodeTemplate: %s", waitErr) + return fmt.Errorf("Error waiting to create NodeTemplate: %s", err) } log.Printf("[DEBUG] Finished creating NodeTemplate %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_autoscaler.go b/google-beta/resource_compute_region_autoscaler.go index 12d306dd73..4e33ff0d0c 100644 --- a/google-beta/resource_compute_region_autoscaler.go +++ b/google-beta/resource_compute_region_autoscaler.go @@ -338,14 +338,14 @@ func resourceComputeRegionAutoscalerCreate(d *schema.ResourceData, meta interfac } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionAutoscaler", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionAutoscaler: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionAutoscaler: %s", err) } log.Printf("[DEBUG] Finished creating RegionAutoscaler %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_backend_service.go b/google-beta/resource_compute_region_backend_service.go index 66816c7686..58d3e994f7 100644 --- a/google-beta/resource_compute_region_backend_service.go +++ b/google-beta/resource_compute_region_backend_service.go @@ -870,14 +870,14 @@ func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta inte } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionBackendService", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionBackendService: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionBackendService: %s", err) } log.Printf("[DEBUG] Finished creating RegionBackendService %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_disk.go b/google-beta/resource_compute_region_disk.go index f5f37797e3..d68c946d8c 100644 --- a/google-beta/resource_compute_region_disk.go +++ b/google-beta/resource_compute_region_disk.go @@ -372,14 +372,14 @@ func resourceComputeRegionDiskCreate(d *schema.ResourceData, meta interface{}) e } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionDisk", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionDisk: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionDisk: %s", err) } log.Printf("[DEBUG] Finished creating RegionDisk %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_health_check.go b/google-beta/resource_compute_region_health_check.go index 58b9087f1c..1b521dedb4 100644 --- a/google-beta/resource_compute_region_health_check.go +++ b/google-beta/resource_compute_region_health_check.go @@ -610,14 +610,14 @@ func resourceComputeRegionHealthCheckCreate(d *schema.ResourceData, meta interfa } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionHealthCheck", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionHealthCheck: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionHealthCheck: %s", err) } log.Printf("[DEBUG] Finished creating RegionHealthCheck %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_ssl_certificate.go b/google-beta/resource_compute_region_ssl_certificate.go index 3bd1e14f91..932e970285 100644 --- a/google-beta/resource_compute_region_ssl_certificate.go +++ b/google-beta/resource_compute_region_ssl_certificate.go @@ -188,14 +188,14 @@ func resourceComputeRegionSslCertificateCreate(d *schema.ResourceData, meta inte } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionSslCertificate", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionSslCertificate: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionSslCertificate: %s", err) } log.Printf("[DEBUG] Finished creating RegionSslCertificate %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_target_http_proxy.go b/google-beta/resource_compute_region_target_http_proxy.go index f3229f8131..9db728eddd 100644 --- a/google-beta/resource_compute_region_target_http_proxy.go +++ b/google-beta/resource_compute_region_target_http_proxy.go @@ -151,14 +151,14 @@ func resourceComputeRegionTargetHttpProxyCreate(d *schema.ResourceData, meta int } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionTargetHttpProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionTargetHttpProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionTargetHttpProxy: %s", err) } log.Printf("[DEBUG] Finished creating RegionTargetHttpProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_target_https_proxy.go b/google-beta/resource_compute_region_target_https_proxy.go index c43d891b2a..47e2b4ea40 100644 --- a/google-beta/resource_compute_region_target_https_proxy.go +++ b/google-beta/resource_compute_region_target_https_proxy.go @@ -168,14 +168,14 @@ func resourceComputeRegionTargetHttpsProxyCreate(d *schema.ResourceData, meta in } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionTargetHttpsProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionTargetHttpsProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionTargetHttpsProxy: %s", err) } log.Printf("[DEBUG] Finished creating RegionTargetHttpsProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_region_url_map.go b/google-beta/resource_compute_region_url_map.go index 40a7f38c0c..4560458fdd 100644 --- a/google-beta/resource_compute_region_url_map.go +++ b/google-beta/resource_compute_region_url_map.go @@ -304,14 +304,14 @@ func resourceComputeRegionUrlMapCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RegionUrlMap", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RegionUrlMap: %s", waitErr) + return fmt.Errorf("Error waiting to create RegionUrlMap: %s", err) } log.Printf("[DEBUG] Finished creating RegionUrlMap %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_reservation.go b/google-beta/resource_compute_reservation.go index a1a6de7373..52de368c82 100644 --- a/google-beta/resource_compute_reservation.go +++ b/google-beta/resource_compute_reservation.go @@ -264,14 +264,14 @@ func resourceComputeReservationCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Reservation", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Reservation: %s", waitErr) + return fmt.Errorf("Error waiting to create Reservation: %s", err) } log.Printf("[DEBUG] Finished creating Reservation %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_resource_policy.go b/google-beta/resource_compute_resource_policy.go index 7eaee33d32..ef17caad1f 100644 --- a/google-beta/resource_compute_resource_policy.go +++ b/google-beta/resource_compute_resource_policy.go @@ -302,14 +302,14 @@ func resourceComputeResourcePolicyCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating ResourcePolicy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create ResourcePolicy: %s", waitErr) + return fmt.Errorf("Error waiting to create ResourcePolicy: %s", err) } log.Printf("[DEBUG] Finished creating ResourcePolicy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_route.go b/google-beta/resource_compute_route.go index 55b62e91d0..460eaeaa33 100644 --- a/google-beta/resource_compute_route.go +++ b/google-beta/resource_compute_route.go @@ -269,14 +269,14 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Route", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Route: %s", waitErr) + return fmt.Errorf("Error waiting to create Route: %s", err) } log.Printf("[DEBUG] Finished creating Route %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_router.go b/google-beta/resource_compute_router.go index a9d9f73cfa..6033404950 100644 --- a/google-beta/resource_compute_router.go +++ b/google-beta/resource_compute_router.go @@ -223,14 +223,14 @@ func resourceComputeRouterCreate(d *schema.ResourceData, meta interface{}) error } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Router", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Router: %s", waitErr) + return fmt.Errorf("Error waiting to create Router: %s", err) } log.Printf("[DEBUG] Finished creating Router %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_router_bgp_peer.go b/google-beta/resource_compute_router_bgp_peer.go index 41ff336fa2..95c0f224f3 100644 --- a/google-beta/resource_compute_router_bgp_peer.go +++ b/google-beta/resource_compute_router_bgp_peer.go @@ -269,14 +269,14 @@ func resourceComputeRouterBgpPeerCreate(d *schema.ResourceData, meta interface{} } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RouterBgpPeer", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RouterBgpPeer: %s", waitErr) + return fmt.Errorf("Error waiting to create RouterBgpPeer: %s", err) } log.Printf("[DEBUG] Finished creating RouterBgpPeer %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_router_nat.go b/google-beta/resource_compute_router_nat.go index 50ecc5b923..b5a75ccabd 100644 --- a/google-beta/resource_compute_router_nat.go +++ b/google-beta/resource_compute_router_nat.go @@ -411,14 +411,14 @@ func resourceComputeRouterNatCreate(d *schema.ResourceData, meta interface{}) er } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating RouterNat", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create RouterNat: %s", waitErr) + return fmt.Errorf("Error waiting to create RouterNat: %s", err) } log.Printf("[DEBUG] Finished creating RouterNat %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_snapshot.go b/google-beta/resource_compute_snapshot.go index 14ac85c692..88462a215c 100644 --- a/google-beta/resource_compute_snapshot.go +++ b/google-beta/resource_compute_snapshot.go @@ -261,14 +261,14 @@ func resourceComputeSnapshotCreate(d *schema.ResourceData, meta interface{}) err } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Snapshot", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Snapshot: %s", waitErr) + return fmt.Errorf("Error waiting to create Snapshot: %s", err) } log.Printf("[DEBUG] Finished creating Snapshot %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_ssl_certificate.go b/google-beta/resource_compute_ssl_certificate.go index b2f4c29498..e213a0b5fb 100644 --- a/google-beta/resource_compute_ssl_certificate.go +++ b/google-beta/resource_compute_ssl_certificate.go @@ -173,14 +173,14 @@ func resourceComputeSslCertificateCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating SslCertificate", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create SslCertificate: %s", waitErr) + return fmt.Errorf("Error waiting to create SslCertificate: %s", err) } log.Printf("[DEBUG] Finished creating SslCertificate %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_ssl_policy.go b/google-beta/resource_compute_ssl_policy.go index 4a09b463f3..715010f9be 100644 --- a/google-beta/resource_compute_ssl_policy.go +++ b/google-beta/resource_compute_ssl_policy.go @@ -218,14 +218,14 @@ func resourceComputeSslPolicyCreate(d *schema.ResourceData, meta interface{}) er } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating SslPolicy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create SslPolicy: %s", waitErr) + return fmt.Errorf("Error waiting to create SslPolicy: %s", err) } log.Printf("[DEBUG] Finished creating SslPolicy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_subnetwork.go b/google-beta/resource_compute_subnetwork.go index ff94b6120d..0cc4e0de72 100644 --- a/google-beta/resource_compute_subnetwork.go +++ b/google-beta/resource_compute_subnetwork.go @@ -399,14 +399,14 @@ func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) e } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating Subnetwork", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Subnetwork: %s", waitErr) + return fmt.Errorf("Error waiting to create Subnetwork: %s", err) } log.Printf("[DEBUG] Finished creating Subnetwork %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_target_http_proxy.go b/google-beta/resource_compute_target_http_proxy.go index cf31460ddc..2706042f78 100644 --- a/google-beta/resource_compute_target_http_proxy.go +++ b/google-beta/resource_compute_target_http_proxy.go @@ -136,14 +136,14 @@ func resourceComputeTargetHttpProxyCreate(d *schema.ResourceData, meta interface } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating TargetHttpProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create TargetHttpProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create TargetHttpProxy: %s", err) } log.Printf("[DEBUG] Finished creating TargetHttpProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_target_https_proxy.go b/google-beta/resource_compute_target_https_proxy.go index 29f6bcd108..279282cd46 100644 --- a/google-beta/resource_compute_target_https_proxy.go +++ b/google-beta/resource_compute_target_https_proxy.go @@ -186,14 +186,14 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating TargetHttpsProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create TargetHttpsProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create TargetHttpsProxy: %s", err) } log.Printf("[DEBUG] Finished creating TargetHttpsProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_target_instance.go b/google-beta/resource_compute_target_instance.go index f9b84656ca..953ec01ca4 100644 --- a/google-beta/resource_compute_target_instance.go +++ b/google-beta/resource_compute_target_instance.go @@ -164,14 +164,14 @@ func resourceComputeTargetInstanceCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating TargetInstance", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create TargetInstance: %s", waitErr) + return fmt.Errorf("Error waiting to create TargetInstance: %s", err) } log.Printf("[DEBUG] Finished creating TargetInstance %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_target_ssl_proxy.go b/google-beta/resource_compute_target_ssl_proxy.go index fdc9f74b70..5e120c95a3 100644 --- a/google-beta/resource_compute_target_ssl_proxy.go +++ b/google-beta/resource_compute_target_ssl_proxy.go @@ -182,14 +182,14 @@ func resourceComputeTargetSslProxyCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating TargetSslProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create TargetSslProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create TargetSslProxy: %s", err) } log.Printf("[DEBUG] Finished creating TargetSslProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_target_tcp_proxy.go b/google-beta/resource_compute_target_tcp_proxy.go index 9f075f7487..4839909174 100644 --- a/google-beta/resource_compute_target_tcp_proxy.go +++ b/google-beta/resource_compute_target_tcp_proxy.go @@ -150,14 +150,14 @@ func resourceComputeTargetTcpProxyCreate(d *schema.ResourceData, meta interface{ } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating TargetTcpProxy", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create TargetTcpProxy: %s", waitErr) + return fmt.Errorf("Error waiting to create TargetTcpProxy: %s", err) } log.Printf("[DEBUG] Finished creating TargetTcpProxy %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_url_map.go b/google-beta/resource_compute_url_map.go index 6154af0ef8..c6264ad75f 100644 --- a/google-beta/resource_compute_url_map.go +++ b/google-beta/resource_compute_url_map.go @@ -287,14 +287,14 @@ func resourceComputeUrlMapCreate(d *schema.ResourceData, meta interface{}) error } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating UrlMap", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create UrlMap: %s", waitErr) + return fmt.Errorf("Error waiting to create UrlMap: %s", err) } log.Printf("[DEBUG] Finished creating UrlMap %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_vpn_gateway.go b/google-beta/resource_compute_vpn_gateway.go index 4cd99ee022..e3dff6217b 100644 --- a/google-beta/resource_compute_vpn_gateway.go +++ b/google-beta/resource_compute_vpn_gateway.go @@ -148,14 +148,14 @@ func resourceComputeVpnGatewayCreate(d *schema.ResourceData, meta interface{}) e } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating VpnGateway", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create VpnGateway: %s", waitErr) + return fmt.Errorf("Error waiting to create VpnGateway: %s", err) } log.Printf("[DEBUG] Finished creating VpnGateway %q: %#v", d.Id(), res) diff --git a/google-beta/resource_compute_vpn_tunnel.go b/google-beta/resource_compute_vpn_tunnel.go index c731d3c585..9656999413 100644 --- a/google-beta/resource_compute_vpn_tunnel.go +++ b/google-beta/resource_compute_vpn_tunnel.go @@ -458,14 +458,14 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er } d.SetId(id) - waitErr := computeOperationWaitTime( + err = computeOperationWaitTime( config, res, project, "Creating VpnTunnel", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create VpnTunnel: %s", waitErr) + return fmt.Errorf("Error waiting to create VpnTunnel: %s", err) } log.Printf("[DEBUG] Finished creating VpnTunnel %q: %#v", d.Id(), res) diff --git a/google-beta/resource_data_fusion_instance.go b/google-beta/resource_data_fusion_instance.go index 3a3268ea5b..c3123acd7e 100644 --- a/google-beta/resource_data_fusion_instance.go +++ b/google-beta/resource_data_fusion_instance.go @@ -53,12 +53,12 @@ func resourceDataFusionInstance() *schema.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"BASIC", "ENTERPRISE"}, false), - Description: `Represents the type of Data Fusion instance. Each type is configured with + Description: `Represents the type of Data Fusion instance. Each type is configured with the default settings for processing and memory. -- BASIC: Basic Data Fusion instance. In Basic type, the user will be able to create data pipelines -using point and click UI. However, there are certain limitations, such as fewer number +- BASIC: Basic Data Fusion instance. In Basic type, the user will be able to create data pipelines +using point and click UI. However, there are certain limitations, such as fewer number of concurrent pipelines, no support for streaming pipelines, etc. -- ENTERPRISE: Enterprise Data Fusion instance. In Enterprise type, the user will have more features +- ENTERPRISE: Enterprise Data Fusion instance. In Enterprise type, the user will have more features available, such as support for streaming pipelines, higher number of concurrent pipelines, etc.`, }, "description": { @@ -104,7 +104,7 @@ nodes. This range must not overlap with any other ranges used in the Data Fusion Required: true, ForceNew: true, Description: `Name of the network in the project with which the tenant project -will be peered for executing pipelines. In case of shared VPC where the network resides in another host +will be peered for executing pipelines. In case of shared VPC where the network resides in another host project the network should specified in the form of projects/{host-project-id}/global/networks/{network}`, }, }, @@ -259,14 +259,14 @@ func resourceDataFusionInstanceCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := dataFusionOperationWaitTime( + err = dataFusionOperationWaitTime( config, res, project, "Creating Instance", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Instance: %s", waitErr) + return fmt.Errorf("Error waiting to create Instance: %s", err) } log.Printf("[DEBUG] Finished creating Instance %q: %#v", d.Id(), res) diff --git a/google-beta/resource_filestore_instance.go b/google-beta/resource_filestore_instance.go index 78fc6c9654..7b110a067c 100644 --- a/google-beta/resource_filestore_instance.go +++ b/google-beta/resource_filestore_instance.go @@ -218,14 +218,14 @@ func resourceFilestoreInstanceCreate(d *schema.ResourceData, meta interface{}) e } d.SetId(id) - waitErr := filestoreOperationWaitTime( + err = filestoreOperationWaitTime( config, res, project, "Creating Instance", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Instance: %s", waitErr) + return fmt.Errorf("Error waiting to create Instance: %s", err) } log.Printf("[DEBUG] Finished creating Instance %q: %#v", d.Id(), res) diff --git a/google-beta/resource_firestore_index.go b/google-beta/resource_firestore_index.go index f651ba70d4..79f27cd2d7 100644 --- a/google-beta/resource_firestore_index.go +++ b/google-beta/resource_firestore_index.go @@ -173,14 +173,14 @@ func resourceFirestoreIndexCreate(d *schema.ResourceData, meta interface{}) erro } d.SetId(id) - waitErr := firestoreOperationWaitTime( + err = firestoreOperationWaitTime( config, res, project, "Creating Index", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Index: %s", waitErr) + return fmt.Errorf("Error waiting to create Index: %s", err) } log.Printf("[DEBUG] Finished creating Index %q: %#v", d.Id(), res) diff --git a/google-beta/resource_redis_instance.go b/google-beta/resource_redis_instance.go index a3bba9c997..96da124def 100644 --- a/google-beta/resource_redis_instance.go +++ b/google-beta/resource_redis_instance.go @@ -279,14 +279,14 @@ func resourceRedisInstanceCreate(d *schema.ResourceData, meta interface{}) error } d.SetId(id) - waitErr := redisOperationWaitTime( + err = redisOperationWaitTime( config, res, project, "Creating Instance", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Instance: %s", waitErr) + return fmt.Errorf("Error waiting to create Instance: %s", err) } log.Printf("[DEBUG] Finished creating Instance %q: %#v", d.Id(), res) diff --git a/google-beta/resource_spanner_database.go b/google-beta/resource_spanner_database.go index 7b0cbf7e72..d7ac87be4a 100644 --- a/google-beta/resource_spanner_database.go +++ b/google-beta/resource_spanner_database.go @@ -131,14 +131,14 @@ func resourceSpannerDatabaseCreate(d *schema.ResourceData, meta interface{}) err } d.SetId(id) - waitErr := spannerOperationWaitTime( + err = spannerOperationWaitTime( config, res, project, "Creating Database", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Database: %s", waitErr) + return fmt.Errorf("Error waiting to create Database: %s", err) } log.Printf("[DEBUG] Finished creating Database %q: %#v", d.Id(), res) diff --git a/google-beta/resource_spanner_instance.go b/google-beta/resource_spanner_instance.go index 361a0e7abb..2cbcba7846 100644 --- a/google-beta/resource_spanner_instance.go +++ b/google-beta/resource_spanner_instance.go @@ -165,14 +165,14 @@ func resourceSpannerInstanceCreate(d *schema.ResourceData, meta interface{}) err } d.SetId(id) - waitErr := spannerOperationWaitTime( + err = spannerOperationWaitTime( config, res, project, "Creating Instance", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Instance: %s", waitErr) + return fmt.Errorf("Error waiting to create Instance: %s", err) } log.Printf("[DEBUG] Finished creating Instance %q: %#v", d.Id(), res) diff --git a/google-beta/resource_sql_database.go b/google-beta/resource_sql_database.go index 272d324d34..5d81d52099 100644 --- a/google-beta/resource_sql_database.go +++ b/google-beta/resource_sql_database.go @@ -147,14 +147,14 @@ func resourceSQLDatabaseCreate(d *schema.ResourceData, meta interface{}) error { } d.SetId(id) - waitErr := sqlAdminOperationWaitTime( + err = sqlAdminOperationWaitTime( config, res, project, "Creating Database", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Database: %s", waitErr) + return fmt.Errorf("Error waiting to create Database: %s", err) } log.Printf("[DEBUG] Finished creating Database %q: %#v", d.Id(), res) diff --git a/google-beta/resource_tpu_node.go b/google-beta/resource_tpu_node.go index 3fa6853ab5..e175dd2e0b 100644 --- a/google-beta/resource_tpu_node.go +++ b/google-beta/resource_tpu_node.go @@ -270,14 +270,14 @@ func resourceTPUNodeCreate(d *schema.ResourceData, meta interface{}) error { } d.SetId(id) - waitErr := tpuOperationWaitTime( + err = tpuOperationWaitTime( config, res, project, "Creating Node", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Node: %s", waitErr) + return fmt.Errorf("Error waiting to create Node: %s", err) } log.Printf("[DEBUG] Finished creating Node %q: %#v", d.Id(), res) diff --git a/google-beta/resource_vpc_access_connector.go b/google-beta/resource_vpc_access_connector.go index 2b72410198..ff527286d9 100644 --- a/google-beta/resource_vpc_access_connector.go +++ b/google-beta/resource_vpc_access_connector.go @@ -163,14 +163,14 @@ func resourceVPCAccessConnectorCreate(d *schema.ResourceData, meta interface{}) } d.SetId(id) - waitErr := vpcAccessOperationWaitTime( + err = vpcAccessOperationWaitTime( config, res, project, "Creating Connector", int(d.Timeout(schema.TimeoutCreate).Minutes())) - if waitErr != nil { + if err != nil { // The resource didn't actually create d.SetId("") - return fmt.Errorf("Error waiting to create Connector: %s", waitErr) + return fmt.Errorf("Error waiting to create Connector: %s", err) } log.Printf("[DEBUG] Finished creating Connector %q: %#v", d.Id(), res) diff --git a/website/docs/r/cloud_run_service.html.markdown b/website/docs/r/cloud_run_service.html.markdown index 41b6db4f27..9163e79451 100644 --- a/website/docs/r/cloud_run_service.html.markdown +++ b/website/docs/r/cloud_run_service.html.markdown @@ -44,6 +44,11 @@ To get more information about Service, see: * How-to Guides * [Official Documentation](https://cloud.google.com/run/docs/) +
## Example Usage - Cloud Run Service Basic @@ -470,8 +475,8 @@ The `conditions` block contains: This resource provides the following [Timeouts](/docs/configuration/resources.html#timeouts) configuration options: -- `create` - Default is 4 minutes. -- `update` - Default is 4 minutes. +- `create` - Default is 6 minutes. +- `update` - Default is 6 minutes. - `delete` - Default is 4 minutes. ## Import diff --git a/website/docs/r/data_fusion_instance.html.markdown b/website/docs/r/data_fusion_instance.html.markdown index e459f5354d..ca71183561 100644 --- a/website/docs/r/data_fusion_instance.html.markdown +++ b/website/docs/r/data_fusion_instance.html.markdown @@ -88,12 +88,12 @@ The following arguments are supported: * `type` - (Required) - Represents the type of Data Fusion instance. Each type is configured with + Represents the type of Data Fusion instance. Each type is configured with the default settings for processing and memory. - - BASIC: Basic Data Fusion instance. In Basic type, the user will be able to create data pipelines - using point and click UI. However, there are certain limitations, such as fewer number + - BASIC: Basic Data Fusion instance. In Basic type, the user will be able to create data pipelines + using point and click UI. However, there are certain limitations, such as fewer number of concurrent pipelines, no support for streaming pipelines, etc. - - ENTERPRISE: Enterprise Data Fusion instance. In Enterprise type, the user will have more features + - ENTERPRISE: Enterprise Data Fusion instance. In Enterprise type, the user will have more features available, such as support for streaming pipelines, higher number of concurrent pipelines, etc. @@ -149,7 +149,7 @@ The `network_config` block supports: * `network` - (Required) Name of the network in the project with which the tenant project - will be peered for executing pipelines. In case of shared VPC where the network resides in another host + will be peered for executing pipelines. In case of shared VPC where the network resides in another host project the network should specified in the form of projects/{host-project-id}/global/networks/{network} ## Attributes Reference