From 8384a6804f47a584aea8fd64959e7c49aa5303e1 Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Wed, 24 Jul 2019 10:59:42 -0700 Subject: [PATCH 1/7] retries for CRM --- .../resources/resource_google_folder.go | 46 ++++++++++----- ...ource_google_folder_organization_policy.go | 51 +++++++++-------- .../resource_google_organization_policy.go | 45 ++++++++------- .../resources/resource_google_project.go | 57 +++++++++++++------ ...urce_google_project_organization_policy.go | 49 ++++++++-------- 5 files changed, 150 insertions(+), 98 deletions(-) diff --git a/third_party/terraform/resources/resource_google_folder.go b/third_party/terraform/resources/resource_google_folder.go index d9079be4b0e7..01a92d6d2927 100644 --- a/third_party/terraform/resources/resource_google_folder.go +++ b/third_party/terraform/resources/resource_google_folder.go @@ -55,10 +55,14 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error displayName := d.Get("display_name").(string) parent := d.Get("parent").(string) - op, err := config.clientResourceManagerV2Beta1.Folders.Create(&resourceManagerV2Beta1.Folder{ - DisplayName: displayName, - }).Parent(parent).Do() - + var op *resourceManagerV2Beta1.Operation + err := retry(func() error { + var reqErr error + op, reqErr = config.clientResourceManagerV2Beta1.Folders.Create(&resourceManagerV2Beta1.Folder{ + DisplayName: displayName, + }).Parent(parent).Do() + return reqErr + }) if err != nil { return fmt.Errorf("Error creating folder '%s' in '%s': %s", displayName, parent, err) } @@ -95,7 +99,12 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error func resourceGoogleFolderRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - folder, err := config.clientResourceManagerV2Beta1.Folders.Get(d.Id()).Do() + var folder *resourceManagerV2Beta1.Folder + err := retry(func() error { + var reqErr error + folder, reqErr = config.clientResourceManagerV2Beta1.Folders.Get(d.Id()).Do() + return reqErr + }) if err != nil { return handleNotFoundError(err, d, d.Id()) } @@ -115,10 +124,12 @@ func resourceGoogleFolderUpdate(d *schema.ResourceData, meta interface{}) error d.Partial(true) if d.HasChange("display_name") { - _, err := config.clientResourceManagerV2Beta1.Folders.Patch(d.Id(), &resourceManagerV2Beta1.Folder{ - DisplayName: displayName, - }).Do() - + err := retry(func() error { + _, reqErr := config.clientResourceManagerV2Beta1.Folders.Patch(d.Id(), &resourceManagerV2Beta1.Folder{ + DisplayName: displayName, + }).Do() + return reqErr + }) if err != nil { return fmt.Errorf("Error updating display_name to '%s': %s", displayName, err) } @@ -128,10 +139,15 @@ func resourceGoogleFolderUpdate(d *schema.ResourceData, meta interface{}) error if d.HasChange("parent") { newParent := d.Get("parent").(string) - op, err := config.clientResourceManagerV2Beta1.Folders.Move(d.Id(), &resourceManagerV2Beta1.MoveFolderRequest{ - DestinationParent: newParent, - }).Do() + var op *resourceManagerV2Beta1.Operation + err := retry(func() error { + var reqErr error + op, reqErr = config.clientResourceManagerV2Beta1.Folders.Move(d.Id(), &resourceManagerV2Beta1.MoveFolderRequest{ + DestinationParent: newParent, + }).Do() + return reqErr + }) if err != nil { return fmt.Errorf("Error moving folder '%s' to '%s': %s", displayName, newParent, err) } @@ -158,11 +174,13 @@ func resourceGoogleFolderDelete(d *schema.ResourceData, meta interface{}) error config := meta.(*Config) displayName := d.Get("display_name").(string) - _, err := config.clientResourceManagerV2Beta1.Folders.Delete(d.Id()).Do() + err := retry(func() error { + _, reqErr := config.clientResourceManagerV2Beta1.Folders.Delete(d.Id()).Do() + return reqErr + }) if err != nil { return fmt.Errorf("Error deleting folder '%s': %s", displayName, err) } - return nil } diff --git a/third_party/terraform/resources/resource_google_folder_organization_policy.go b/third_party/terraform/resources/resource_google_folder_organization_policy.go index ebf367fdc0fe..b4c6dd23676f 100644 --- a/third_party/terraform/resources/resource_google_folder_organization_policy.go +++ b/third_party/terraform/resources/resource_google_folder_organization_policy.go @@ -68,10 +68,13 @@ func resourceGoogleFolderOrganizationPolicyRead(d *schema.ResourceData, meta int config := meta.(*Config) folder := canonicalFolderId(d.Get("folder").(string)) - policy, err := config.clientResourceManager.Folders.GetOrgPolicy(folder, &cloudresourcemanager.GetOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - + var policy *cloudresourcemanager.OrgPolicy + err := retry(func() (getErr error) { + policy, getErr = config.clientResourceManager.Folders.GetOrgPolicy(folder, &cloudresourcemanager.GetOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() + return getErr + }) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", folder)) } @@ -103,15 +106,12 @@ func resourceGoogleFolderOrganizationPolicyDelete(d *schema.ResourceData, meta i config := meta.(*Config) folder := canonicalFolderId(d.Get("folder").(string)) - _, err := config.clientResourceManager.Folders.ClearOrgPolicy(folder, &cloudresourcemanager.ClearOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - - if err != nil { - return err - } - - return nil + return retry(func() (delErr error) { + _, delErr = config.clientResourceManager.Folders.ClearOrgPolicy(folder, &cloudresourcemanager.ClearOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() + return delErr + }) } func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { @@ -128,16 +128,17 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error return err } - _, err = config.clientResourceManager.Folders.SetOrgPolicy(folder, &cloudresourcemanager.SetOrgPolicyRequest{ - Policy: &cloudresourcemanager.OrgPolicy{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), - ListPolicy: listPolicy, - RestoreDefault: restoreDefault, - Version: int64(d.Get("version").(int)), - Etag: d.Get("etag").(string), - }, - }).Do() - - return err + return retry(func() (setErr error) { + _, setErr = config.clientResourceManager.Folders.SetOrgPolicy(folder, &cloudresourcemanager.SetOrgPolicyRequest{ + Policy: &cloudresourcemanager.OrgPolicy{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), + ListPolicy: listPolicy, + RestoreDefault: restoreDefault, + Version: int64(d.Get("version").(int)), + Etag: d.Get("etag").(string), + }, + }).Do() + return setErr + }) } diff --git a/third_party/terraform/resources/resource_google_organization_policy.go b/third_party/terraform/resources/resource_google_organization_policy.go index 2c7f96e185e5..7dbdf19971c4 100644 --- a/third_party/terraform/resources/resource_google_organization_policy.go +++ b/third_party/terraform/resources/resource_google_organization_policy.go @@ -161,10 +161,13 @@ func resourceGoogleOrganizationPolicyRead(d *schema.ResourceData, meta interface config := meta.(*Config) org := "organizations/" + d.Get("org_id").(string) - policy, err := config.clientResourceManager.Organizations.GetOrgPolicy(org, &cloudresourcemanager.GetOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - + var policy *cloudresourcemanager.OrgPolicy + err := retry(func() (readErr error) { + policy, readErr = config.clientResourceManager.Organizations.GetOrgPolicy(org, &cloudresourcemanager.GetOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() + return readErr + }) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", org)) } @@ -196,10 +199,12 @@ func resourceGoogleOrganizationPolicyDelete(d *schema.ResourceData, meta interfa config := meta.(*Config) org := "organizations/" + d.Get("org_id").(string) - _, err := config.clientResourceManager.Organizations.ClearOrgPolicy(org, &cloudresourcemanager.ClearOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - + err := retry(func() error { + _, dErr := config.clientResourceManager.Organizations.ClearOrgPolicy(org, &cloudresourcemanager.ClearOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() + return dErr + }) if err != nil { return err } @@ -246,17 +251,19 @@ func setOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { return err } - _, err = config.clientResourceManager.Organizations.SetOrgPolicy(org, &cloudresourcemanager.SetOrgPolicyRequest{ - Policy: &cloudresourcemanager.OrgPolicy{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), - ListPolicy: listPolicy, - RestoreDefault: restoreDefault, - Version: int64(d.Get("version").(int)), - Etag: d.Get("etag").(string), - }, - }).Do() - + err = retry(func() (setErr error) { + _, setErr = config.clientResourceManager.Organizations.SetOrgPolicy(org, &cloudresourcemanager.SetOrgPolicyRequest{ + Policy: &cloudresourcemanager.OrgPolicy{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), + ListPolicy: listPolicy, + RestoreDefault: restoreDefault, + Version: int64(d.Get("version").(int)), + Etag: d.Get("etag").(string), + }, + }).Do() + return setErr + }) return err } diff --git a/third_party/terraform/resources/resource_google_project.go b/third_party/terraform/resources/resource_google_project.go index 8a25b6e21907..608ec5040274 100644 --- a/third_party/terraform/resources/resource_google_project.go +++ b/third_party/terraform/resources/resource_google_project.go @@ -3,7 +3,6 @@ package google import ( "fmt" "log" - "net/http" "regexp" "strconv" "strings" @@ -216,7 +215,11 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error project.Labels = expandLabels(d) } - op, err := config.clientResourceManager.Projects.Create(project).Do() + var op *cloudresourcemanager.Operation + err = retry(func() (reqErr error) { + op, reqErr = config.clientResourceManager.Projects.Create(project).Do() + return reqErr + }) if err != nil { return fmt.Errorf("error creating project %s (%s): %s. "+ "If you received a 403 error, make sure you have the"+ @@ -273,8 +276,7 @@ func resourceGoogleProjectRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) pid := d.Id() - // Read the project - p, err := config.clientResourceManager.Projects.Get(pid).Do() + p, err := readGoogleProject(d, config) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Project %q", pid)) } @@ -306,8 +308,12 @@ func resourceGoogleProjectRead(d *schema.ResourceData, meta interface{}) error { } } + var ba *cloudbilling.ProjectBillingInfo + err = retry(func() (reqErr error) { + ba, reqErr = config.clientBilling.Projects.GetBillingInfo(prefixedProject(pid)).Do() + return reqErr + }) // Read the billing account - ba, err := config.clientBilling.Projects.GetBillingInfo(prefixedProject(pid)).Do() if err != nil && !isApiNotEnabledError(err) { return fmt.Errorf("Error reading billing account for project %q: %v", prefixedProject(pid), err) } else if isApiNotEnabledError(err) { @@ -374,9 +380,9 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error // Read the project // we need the project even though refresh has already been called // because the API doesn't support patch, so we need the actual object - p, err := config.clientResourceManager.Projects.Get(pid).Do() + p, err := readGoogleProject(d, config) if err != nil { - if v, ok := err.(*googleapi.Error); ok && v.Code == http.StatusNotFound { + if isGoogleApiErrorWithCode(err, 404) { return fmt.Errorf("Project %q does not exist.", pid) } return fmt.Errorf("Error checking project %q: %s", pid, err) @@ -388,10 +394,13 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error if ok := d.HasChange("name"); ok { p.Name = project_name // Do update on project - p, err = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() - if err != nil { + if err = retry(func() (updateErr error) { + p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() + return updateErr + }); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } + d.SetPartial("name") } @@ -402,8 +411,10 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error } // Do update on project - p, err = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() - if err != nil { + if err = retry(func() (updateErr error) { + p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() + return updateErr + }); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } d.SetPartial("org_id") @@ -423,8 +434,10 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error p.Labels = expandLabels(d) // Do Update on project - p, err = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() - if err != nil { + if err = retry(func() (updateErr error) { + p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() + return updateErr + }); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } d.SetPartial("labels") @@ -439,9 +452,11 @@ func resourceGoogleProjectDelete(d *schema.ResourceData, meta interface{}) error // Only delete projects if skip_delete isn't set if !d.Get("skip_delete").(bool) { pid := d.Id() - _, err := config.clientResourceManager.Projects.Delete(pid).Do() - if err != nil { - return fmt.Errorf("Error deleting project %q: %s", pid, err) + if err := retry(func() error { + _, delErr := config.clientResourceManager.Projects.Delete(pid).Do() + return delErr + }); err != nil { + return handleNotFoundError(err, d, fmt.Sprintf("Project %s", pid)) } } d.SetId("") @@ -542,3 +557,13 @@ func deleteComputeNetwork(project, network string, config *Config) error { } return nil } + +func readGoogleProject(d *schema.ResourceData, config *Config) (*cloudresourcemanager.Project, error) { + var p *cloudresourcemanager.Project + // Read the project + err := retry(func() (reqErr error) { + p, reqErr = config.clientResourceManager.Projects.Get(d.Id()).Do() + return reqErr + }) + return p, err +} diff --git a/third_party/terraform/resources/resource_google_project_organization_policy.go b/third_party/terraform/resources/resource_google_project_organization_policy.go index f509782ab288..3b3c4e89f6e1 100644 --- a/third_party/terraform/resources/resource_google_project_organization_policy.go +++ b/third_party/terraform/resources/resource_google_project_organization_policy.go @@ -67,10 +67,13 @@ func resourceGoogleProjectOrganizationPolicyRead(d *schema.ResourceData, meta in config := meta.(*Config) project := prefixedProject(d.Get("project").(string)) - policy, err := config.clientResourceManager.Projects.GetOrgPolicy(project, &cloudresourcemanager.GetOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - + var policy *cloudresourcemanager.OrgPolicy + err := retry(func() (readErr error) { + policy, readErr = config.clientResourceManager.Projects.GetOrgPolicy(project, &cloudresourcemanager.GetOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() + return readErr + }) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", project)) } @@ -102,15 +105,12 @@ func resourceGoogleProjectOrganizationPolicyDelete(d *schema.ResourceData, meta config := meta.(*Config) project := prefixedProject(d.Get("project").(string)) - _, err := config.clientResourceManager.Projects.ClearOrgPolicy(project, &cloudresourcemanager.ClearOrgPolicyRequest{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - }).Do() - - if err != nil { + return retry(func() error { + _, err := config.clientResourceManager.Projects.ClearOrgPolicy(project, &cloudresourcemanager.ClearOrgPolicyRequest{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + }).Do() return err - } - - return nil + }) } func setProjectOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { @@ -127,16 +127,17 @@ func setProjectOrganizationPolicy(d *schema.ResourceData, meta interface{}) erro return err } - _, err = config.clientResourceManager.Projects.SetOrgPolicy(project, &cloudresourcemanager.SetOrgPolicyRequest{ - Policy: &cloudresourcemanager.OrgPolicy{ - Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), - BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), - ListPolicy: listPolicy, - RestoreDefault: restore_default, - Version: int64(d.Get("version").(int)), - Etag: d.Get("etag").(string), - }, - }).Do() - - return err + return retry(func() error { + _, err := config.clientResourceManager.Projects.SetOrgPolicy(project, &cloudresourcemanager.SetOrgPolicyRequest{ + Policy: &cloudresourcemanager.OrgPolicy{ + Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), + BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})), + ListPolicy: listPolicy, + RestoreDefault: restore_default, + Version: int64(d.Get("version").(int)), + Etag: d.Get("etag").(string), + }, + }).Do() + return err + }) } From 6cf520c2f7707270b04542ba6419b636ffecbf8e Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Mon, 29 Jul 2019 14:56:36 -0700 Subject: [PATCH 2/7] use scheam timeouts and fix google folder datasource --- .../data_sources/data_source_google_folder.go | 26 ++++--------- .../resources/resource_google_folder.go | 37 ++++++++++++++----- ...ource_google_folder_organization_policy.go | 20 +++++++--- .../resource_google_organization_policy.go | 20 +++++++--- .../resources/resource_google_project.go | 36 +++++++++++------- ...urce_google_project_organization_policy.go | 20 +++++++--- 6 files changed, 99 insertions(+), 60 deletions(-) diff --git a/third_party/terraform/data_sources/data_source_google_folder.go b/third_party/terraform/data_sources/data_source_google_folder.go index df634f99dc91..053adc109b9d 100644 --- a/third_party/terraform/data_sources/data_source_google_folder.go +++ b/third_party/terraform/data_sources/data_source_google_folder.go @@ -53,24 +53,17 @@ func dataSourceGoogleFolder() *schema.Resource { func dataSourceFolderRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - folderName := d.Get("folder").(string) - - folder, err := config.clientResourceManagerV2Beta1.Folders.Get(canonicalFolderName(folderName)).Do() - - if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("Folder Not Found : %s", folderName)) + d.SetId(canonicalFolderName(d.Get("folder").(string)) + if err := resourceGoogleFolderRead(d, meta); err != nil { + return err + } + // If resource doesn't exist, 404 was handled in read(). + if d.Id() == "" { + return nil } - - d.SetId(GetResourceNameFromSelfLink(folder.Name)) - d.Set("name", folder.Name) - d.Set("parent", folder.Parent) - d.Set("display_name", folder.DisplayName) - d.Set("lifecycle_state", folder.LifecycleState) - d.Set("create_time", folder.CreateTime) if v, ok := d.GetOk("lookup_organization"); ok && v.(bool) { organization, err := lookupOrganizationName(folder, config) - if err != nil { return err } @@ -91,16 +84,13 @@ func canonicalFolderName(ba string) string { func lookupOrganizationName(folder *resourceManagerV2Beta1.Folder, config *Config) (string, error) { parent := folder.Parent - if parent == "" || strings.HasPrefix(parent, "organizations/") { return parent, nil } else if strings.HasPrefix(parent, "folders/") { - parentFolder, err := config.clientResourceManagerV2Beta1.Folders.Get(parent).Do() - + parentFolder, err := getGoogleFolder(parent, config).Do() if err != nil { return "", fmt.Errorf("Error getting parent folder '%s': %s", parent, err) } - return lookupOrganizationName(parentFolder, config) } else { return "", fmt.Errorf("Unknown parent type '%s' on folder '%s'", parent, folder.Name) diff --git a/third_party/terraform/resources/resource_google_folder.go b/third_party/terraform/resources/resource_google_folder.go index 01a92d6d2927..57b4e674bb3e 100644 --- a/third_party/terraform/resources/resource_google_folder.go +++ b/third_party/terraform/resources/resource_google_folder.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform/helper/schema" resourceManagerV2Beta1 "google.golang.org/api/cloudresourcemanager/v2beta1" "strings" + "time" ) func resourceGoogleFolder() *schema.Resource { @@ -19,6 +20,14 @@ func resourceGoogleFolder() *schema.Resource { State: resourceGoogleFolderImportState, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Read: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ // Format is either folders/{folder_id} or organizations/{org_id}. "parent": { @@ -56,13 +65,13 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error parent := d.Get("parent").(string) var op *resourceManagerV2Beta1.Operation - err := retry(func() error { + err := retryTimeDuration(func() error { var reqErr error op, reqErr = config.clientResourceManagerV2Beta1.Folders.Create(&resourceManagerV2Beta1.Folder{ DisplayName: displayName, }).Parent(parent).Do() return reqErr - }) + }, d.Timeout(schema.TimeoutCreate)) if err != nil { return fmt.Errorf("Error creating folder '%s' in '%s': %s", displayName, parent, err) } @@ -99,12 +108,7 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error func resourceGoogleFolderRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - var folder *resourceManagerV2Beta1.Folder - err := retry(func() error { - var reqErr error - folder, reqErr = config.clientResourceManagerV2Beta1.Folders.Get(d.Id()).Do() - return reqErr - }) + folder, err := getGoogleFolder(d, config) if err != nil { return handleNotFoundError(err, d, d.Id()) } @@ -174,10 +178,10 @@ func resourceGoogleFolderDelete(d *schema.ResourceData, meta interface{}) error config := meta.(*Config) displayName := d.Get("display_name").(string) - err := retry(func() error { + err := retryTimeDuration(func() error { _, reqErr := config.clientResourceManagerV2Beta1.Folders.Delete(d.Id()).Do() return reqErr - }) + }, d.Timeout(schema.TimeoutDelete)) if err != nil { return fmt.Errorf("Error deleting folder '%s': %s", displayName, err) } @@ -195,3 +199,16 @@ func resourceGoogleFolderImportState(d *schema.ResourceData, m interface{}) ([]* return []*schema.ResourceData{d}, nil } + +func getGoogleFolder(d *schema.ResourceData, config *Config) (*resourceManagerV2Beta1.Folder, error){ + var folder *resourceManagerV2Beta1.Folder + err := retryTimeDuration(func() error { + var reqErr error + folder, reqErr = config.clientResourceManagerV2Beta1.Folders.Get(d.Id()).Do() + return reqErr + }, d.Timeout(schema.TimeoutRead)) + if err != nil { + return nil, err + } + return folder, nil +} \ No newline at end of file diff --git a/third_party/terraform/resources/resource_google_folder_organization_policy.go b/third_party/terraform/resources/resource_google_folder_organization_policy.go index b4c6dd23676f..52b79ef0e4c8 100644 --- a/third_party/terraform/resources/resource_google_folder_organization_policy.go +++ b/third_party/terraform/resources/resource_google_folder_organization_policy.go @@ -2,6 +2,7 @@ package google import ( "fmt" + "time" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/cloudresourcemanager/v1" @@ -18,6 +19,13 @@ func resourceGoogleFolderOrganizationPolicy() *schema.Resource { State: resourceFolderOrgPolicyImporter, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Read: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + Schema: mergeSchemas( schemaOrganizationPolicy, map[string]*schema.Schema{ @@ -69,12 +77,12 @@ func resourceGoogleFolderOrganizationPolicyRead(d *schema.ResourceData, meta int folder := canonicalFolderId(d.Get("folder").(string)) var policy *cloudresourcemanager.OrgPolicy - err := retry(func() (getErr error) { + err := retryTimeDuration(func() (getErr error) { policy, getErr = config.clientResourceManager.Folders.GetOrgPolicy(folder, &cloudresourcemanager.GetOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return getErr - }) + }, d.Timeout(schema.TimeoutRead)) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", folder)) } @@ -106,12 +114,12 @@ func resourceGoogleFolderOrganizationPolicyDelete(d *schema.ResourceData, meta i config := meta.(*Config) folder := canonicalFolderId(d.Get("folder").(string)) - return retry(func() (delErr error) { + return retryTimeDuration(func() (delErr error) { _, delErr = config.clientResourceManager.Folders.ClearOrgPolicy(folder, &cloudresourcemanager.ClearOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return delErr - }) + }, d.Timeout(schema.TimeoutDelete)) } func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { @@ -128,7 +136,7 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error return err } - return retry(func() (setErr error) { + return retryTimeDuration(func() (setErr error) { _, setErr = config.clientResourceManager.Folders.SetOrgPolicy(folder, &cloudresourcemanager.SetOrgPolicyRequest{ Policy: &cloudresourcemanager.OrgPolicy{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), @@ -140,5 +148,5 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error }, }).Do() return setErr - }) + }, d.Timeout(schema.TimeoutCreate)) } diff --git a/third_party/terraform/resources/resource_google_organization_policy.go b/third_party/terraform/resources/resource_google_organization_policy.go index 7dbdf19971c4..85cf77bf2a31 100644 --- a/third_party/terraform/resources/resource_google_organization_policy.go +++ b/third_party/terraform/resources/resource_google_organization_policy.go @@ -3,6 +3,7 @@ package google import ( "fmt" "strings" + "time" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/cloudresourcemanager/v1" @@ -131,6 +132,13 @@ func resourceGoogleOrganizationPolicy() *schema.Resource { State: resourceGoogleOrganizationPolicyImportState, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Read: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + Schema: mergeSchemas( schemaOrganizationPolicy, map[string]*schema.Schema{ @@ -162,12 +170,12 @@ func resourceGoogleOrganizationPolicyRead(d *schema.ResourceData, meta interface org := "organizations/" + d.Get("org_id").(string) var policy *cloudresourcemanager.OrgPolicy - err := retry(func() (readErr error) { + err := retryTimeDuration(func() (readErr error) { policy, readErr = config.clientResourceManager.Organizations.GetOrgPolicy(org, &cloudresourcemanager.GetOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return readErr - }) + }, d.Timeout(schema.TimeoutRead)) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", org)) } @@ -199,12 +207,12 @@ func resourceGoogleOrganizationPolicyDelete(d *schema.ResourceData, meta interfa config := meta.(*Config) org := "organizations/" + d.Get("org_id").(string) - err := retry(func() error { + err := retryTimeDuration(func() error { _, dErr := config.clientResourceManager.Organizations.ClearOrgPolicy(org, &cloudresourcemanager.ClearOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return dErr - }) + }, d.Timeout(schema.TimeoutDelete)) if err != nil { return err } @@ -251,7 +259,7 @@ func setOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { return err } - err = retry(func() (setErr error) { + err = retryTimeDuration(func() (setErr error) { _, setErr = config.clientResourceManager.Organizations.SetOrgPolicy(org, &cloudresourcemanager.SetOrgPolicyRequest{ Policy: &cloudresourcemanager.OrgPolicy{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), @@ -263,7 +271,7 @@ func setOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { }, }).Do() return setErr - }) + }, d.Timeout(schema.TimeoutCreate)) return err } diff --git a/third_party/terraform/resources/resource_google_project.go b/third_party/terraform/resources/resource_google_project.go index 608ec5040274..bd70cf43baa1 100644 --- a/third_party/terraform/resources/resource_google_project.go +++ b/third_party/terraform/resources/resource_google_project.go @@ -28,6 +28,14 @@ func resourceGoogleProject() *schema.Resource { Importer: &schema.ResourceImporter{ State: resourceProjectImportState, }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Read: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + MigrateState: resourceGoogleProjectMigrateState, Schema: map[string]*schema.Schema{ @@ -216,10 +224,10 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error } var op *cloudresourcemanager.Operation - err = retry(func() (reqErr error) { + err = retryTimeDuration(func() (reqErr error) { op, reqErr = config.clientResourceManager.Projects.Create(project).Do() return reqErr - }) + }, d.Timeout(schema.TimeoutCreate)) if err != nil { return fmt.Errorf("error creating project %s (%s): %s. "+ "If you received a 403 error, make sure you have the"+ @@ -309,10 +317,10 @@ func resourceGoogleProjectRead(d *schema.ResourceData, meta interface{}) error { } var ba *cloudbilling.ProjectBillingInfo - err = retry(func() (reqErr error) { + err = retryTimeDuration(func() (reqErr error) { ba, reqErr = config.clientBilling.Projects.GetBillingInfo(prefixedProject(pid)).Do() return reqErr - }) + }, d.Timeout(schema.TimeoutRead)) // Read the billing account if err != nil && !isApiNotEnabledError(err) { return fmt.Errorf("Error reading billing account for project %q: %v", prefixedProject(pid), err) @@ -394,10 +402,10 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error if ok := d.HasChange("name"); ok { p.Name = project_name // Do update on project - if err = retry(func() (updateErr error) { + if err = retryTimeDuration(func() (updateErr error) { p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() return updateErr - }); err != nil { + }, d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } @@ -411,10 +419,10 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error } // Do update on project - if err = retry(func() (updateErr error) { + if err = retryTimeDuration(func() (updateErr error) { p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() return updateErr - }); err != nil { + }, d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } d.SetPartial("org_id") @@ -434,10 +442,10 @@ func resourceGoogleProjectUpdate(d *schema.ResourceData, meta interface{}) error p.Labels = expandLabels(d) // Do Update on project - if err = retry(func() (updateErr error) { + if err = retryTimeDuration(func() (updateErr error) { p, updateErr = config.clientResourceManager.Projects.Update(p.ProjectId, p).Do() return updateErr - }); err != nil { + }, d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("Error updating project %q: %s", project_name, err) } d.SetPartial("labels") @@ -452,10 +460,10 @@ func resourceGoogleProjectDelete(d *schema.ResourceData, meta interface{}) error // Only delete projects if skip_delete isn't set if !d.Get("skip_delete").(bool) { pid := d.Id() - if err := retry(func() error { + if err := retryTimeDuration(func() error { _, delErr := config.clientResourceManager.Projects.Delete(pid).Do() return delErr - }); err != nil { + }, d.Timeout(schema.TimeoutDelete)); err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Project %s", pid)) } } @@ -561,9 +569,9 @@ func deleteComputeNetwork(project, network string, config *Config) error { func readGoogleProject(d *schema.ResourceData, config *Config) (*cloudresourcemanager.Project, error) { var p *cloudresourcemanager.Project // Read the project - err := retry(func() (reqErr error) { + err := retryTimeDuration(func() (reqErr error) { p, reqErr = config.clientResourceManager.Projects.Get(d.Id()).Do() return reqErr - }) + }, d.Timeout(schema.TimeoutRead)) return p, err } diff --git a/third_party/terraform/resources/resource_google_project_organization_policy.go b/third_party/terraform/resources/resource_google_project_organization_policy.go index 3b3c4e89f6e1..6d9b7c9d05fe 100644 --- a/third_party/terraform/resources/resource_google_project_organization_policy.go +++ b/third_party/terraform/resources/resource_google_project_organization_policy.go @@ -2,6 +2,7 @@ package google import ( "fmt" + "time" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/cloudresourcemanager/v1" @@ -18,6 +19,13 @@ func resourceGoogleProjectOrganizationPolicy() *schema.Resource { State: resourceProjectOrgPolicyImporter, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Read: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + Schema: mergeSchemas( schemaOrganizationPolicy, map[string]*schema.Schema{ @@ -68,12 +76,12 @@ func resourceGoogleProjectOrganizationPolicyRead(d *schema.ResourceData, meta in project := prefixedProject(d.Get("project").(string)) var policy *cloudresourcemanager.OrgPolicy - err := retry(func() (readErr error) { + err := retryTimeDuration(func() (readErr error) { policy, readErr = config.clientResourceManager.Projects.GetOrgPolicy(project, &cloudresourcemanager.GetOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return readErr - }) + }, d.Timeout(schema.TimeoutRead)) if err != nil { return handleNotFoundError(err, d, fmt.Sprintf("Organization policy for %s", project)) } @@ -105,12 +113,12 @@ func resourceGoogleProjectOrganizationPolicyDelete(d *schema.ResourceData, meta config := meta.(*Config) project := prefixedProject(d.Get("project").(string)) - return retry(func() error { + return retryTimeDuration(func() error { _, err := config.clientResourceManager.Projects.ClearOrgPolicy(project, &cloudresourcemanager.ClearOrgPolicyRequest{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return err - }) + }, d.Timeout(schema.TimeoutDelete)) } func setProjectOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { @@ -127,7 +135,7 @@ func setProjectOrganizationPolicy(d *schema.ResourceData, meta interface{}) erro return err } - return retry(func() error { + return retryTimeDuration(func() error { _, err := config.clientResourceManager.Projects.SetOrgPolicy(project, &cloudresourcemanager.SetOrgPolicyRequest{ Policy: &cloudresourcemanager.OrgPolicy{ Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), @@ -139,5 +147,5 @@ func setProjectOrganizationPolicy(d *schema.ResourceData, meta interface{}) erro }, }).Do() return err - }) + }, d.Timeout(schema.TimeoutCreate)) } From 413e289b2a2210b1aee7f18f4040ff38b5b63daf Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Mon, 5 Aug 2019 10:37:49 -0700 Subject: [PATCH 3/7] typo --- third_party/terraform/data_sources/data_source_google_folder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/terraform/data_sources/data_source_google_folder.go b/third_party/terraform/data_sources/data_source_google_folder.go index 053adc109b9d..0a537a5caf20 100644 --- a/third_party/terraform/data_sources/data_source_google_folder.go +++ b/third_party/terraform/data_sources/data_source_google_folder.go @@ -53,7 +53,7 @@ func dataSourceGoogleFolder() *schema.Resource { func dataSourceFolderRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - d.SetId(canonicalFolderName(d.Get("folder").(string)) + d.SetId(canonicalFolderName(d.Get("folder").(string))) if err := resourceGoogleFolderRead(d, meta); err != nil { return err } From ccf642a8ae1fb003a1580aea0676fc05398e0813 Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Mon, 5 Aug 2019 11:02:06 -0700 Subject: [PATCH 4/7] fixes --- .../data_sources/data_source_google_folder.go | 13 +++++-------- .../terraform/resources/resource_google_folder.go | 8 +++++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/third_party/terraform/data_sources/data_source_google_folder.go b/third_party/terraform/data_sources/data_source_google_folder.go index 0a537a5caf20..544df3c3ab5c 100644 --- a/third_party/terraform/data_sources/data_source_google_folder.go +++ b/third_party/terraform/data_sources/data_source_google_folder.go @@ -5,8 +5,6 @@ import ( "strings" "github.com/hashicorp/terraform/helper/schema" - - resourceManagerV2Beta1 "google.golang.org/api/cloudresourcemanager/v2beta1" ) func dataSourceGoogleFolder() *schema.Resource { @@ -63,7 +61,7 @@ func dataSourceFolderRead(d *schema.ResourceData, meta interface{}) error { } if v, ok := d.GetOk("lookup_organization"); ok && v.(bool) { - organization, err := lookupOrganizationName(folder, config) + organization, err := lookupOrganizationName(d.Id(), d, config) if err != nil { return err } @@ -82,17 +80,16 @@ func canonicalFolderName(ba string) string { return "folders/" + ba } -func lookupOrganizationName(folder *resourceManagerV2Beta1.Folder, config *Config) (string, error) { - parent := folder.Parent +func lookupOrganizationName(parent string, d *schema.ResourceData, config *Config) (string, error) { if parent == "" || strings.HasPrefix(parent, "organizations/") { return parent, nil } else if strings.HasPrefix(parent, "folders/") { - parentFolder, err := getGoogleFolder(parent, config).Do() + parentFolder, err := getGoogleFolder(parent, d, config) if err != nil { return "", fmt.Errorf("Error getting parent folder '%s': %s", parent, err) } - return lookupOrganizationName(parentFolder, config) + return lookupOrganizationName(parentFolder.Parent, d, config) } else { - return "", fmt.Errorf("Unknown parent type '%s' on folder '%s'", parent, folder.Name) + return "", fmt.Errorf("Unknown parent type '%s' on folder '%s'", parent, d.Id()) } } diff --git a/third_party/terraform/resources/resource_google_folder.go b/third_party/terraform/resources/resource_google_folder.go index 57b4e674bb3e..426bda69346c 100644 --- a/third_party/terraform/resources/resource_google_folder.go +++ b/third_party/terraform/resources/resource_google_folder.go @@ -108,7 +108,7 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error func resourceGoogleFolderRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - folder, err := getGoogleFolder(d, config) + folder, err := getGoogleFolder(d.Id(), d, config) if err != nil { return handleNotFoundError(err, d, d.Id()) } @@ -200,11 +200,13 @@ func resourceGoogleFolderImportState(d *schema.ResourceData, m interface{}) ([]* return []*schema.ResourceData{d}, nil } -func getGoogleFolder(d *schema.ResourceData, config *Config) (*resourceManagerV2Beta1.Folder, error){ +// Util to get a Folder resource from API. Note that folder described by name is not necessarily the +// ResourceData resource. +func getGoogleFolder(folderName string, d *schema.ResourceData, config *Config) (*resourceManagerV2Beta1.Folder, error){ var folder *resourceManagerV2Beta1.Folder err := retryTimeDuration(func() error { var reqErr error - folder, reqErr = config.clientResourceManagerV2Beta1.Folders.Get(d.Id()).Do() + folder, reqErr = config.clientResourceManagerV2Beta1.Folders.Get(folderName).Do() return reqErr }, d.Timeout(schema.TimeoutRead)) if err != nil { From 874b8d7cc515f4ea40ea3f2a1cee479f05a75cae Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Mon, 5 Aug 2019 11:06:51 -0700 Subject: [PATCH 5/7] fmt --- third_party/terraform/resources/resource_google_folder.go | 5 ++--- .../resources/resource_google_folder_organization_policy.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/third_party/terraform/resources/resource_google_folder.go b/third_party/terraform/resources/resource_google_folder.go index 426bda69346c..4ac53e29ccc9 100644 --- a/third_party/terraform/resources/resource_google_folder.go +++ b/third_party/terraform/resources/resource_google_folder.go @@ -27,7 +27,6 @@ func resourceGoogleFolder() *schema.Resource { Delete: schema.DefaultTimeout(4 * time.Minute), }, - Schema: map[string]*schema.Schema{ // Format is either folders/{folder_id} or organizations/{org_id}. "parent": { @@ -202,7 +201,7 @@ func resourceGoogleFolderImportState(d *schema.ResourceData, m interface{}) ([]* // Util to get a Folder resource from API. Note that folder described by name is not necessarily the // ResourceData resource. -func getGoogleFolder(folderName string, d *schema.ResourceData, config *Config) (*resourceManagerV2Beta1.Folder, error){ +func getGoogleFolder(folderName string, d *schema.ResourceData, config *Config) (*resourceManagerV2Beta1.Folder, error) { var folder *resourceManagerV2Beta1.Folder err := retryTimeDuration(func() error { var reqErr error @@ -213,4 +212,4 @@ func getGoogleFolder(folderName string, d *schema.ResourceData, config *Config) return nil, err } return folder, nil -} \ No newline at end of file +} diff --git a/third_party/terraform/resources/resource_google_folder_organization_policy.go b/third_party/terraform/resources/resource_google_folder_organization_policy.go index 52b79ef0e4c8..b4ffa962e760 100644 --- a/third_party/terraform/resources/resource_google_folder_organization_policy.go +++ b/third_party/terraform/resources/resource_google_folder_organization_policy.go @@ -119,7 +119,7 @@ func resourceGoogleFolderOrganizationPolicyDelete(d *schema.ResourceData, meta i Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)), }).Do() return delErr - }, d.Timeout(schema.TimeoutDelete)) + }, d.Timeout(schema.TimeoutDelete)) } func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error { @@ -148,5 +148,5 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error }, }).Do() return setErr - }, d.Timeout(schema.TimeoutCreate)) + }, d.Timeout(schema.TimeoutCreate)) } From adefb8aed42270ef05bb53e7fb37b0ea50727643 Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Mon, 5 Aug 2019 12:25:09 -0700 Subject: [PATCH 6/7] text --- third_party/terraform/data_sources/data_source_google_folder.go | 2 +- third_party/terraform/resources/resource_google_folder.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/terraform/data_sources/data_source_google_folder.go b/third_party/terraform/data_sources/data_source_google_folder.go index 544df3c3ab5c..c782eb249021 100644 --- a/third_party/terraform/data_sources/data_source_google_folder.go +++ b/third_party/terraform/data_sources/data_source_google_folder.go @@ -55,7 +55,7 @@ func dataSourceFolderRead(d *schema.ResourceData, meta interface{}) error { if err := resourceGoogleFolderRead(d, meta); err != nil { return err } - // If resource doesn't exist, 404 was handled in read(). + // If resource doesn't exist, read will not set ID and we should return error. if d.Id() == "" { return nil } diff --git a/third_party/terraform/resources/resource_google_folder.go b/third_party/terraform/resources/resource_google_folder.go index 4ac53e29ccc9..398b285c151a 100644 --- a/third_party/terraform/resources/resource_google_folder.go +++ b/third_party/terraform/resources/resource_google_folder.go @@ -109,7 +109,7 @@ func resourceGoogleFolderRead(d *schema.ResourceData, meta interface{}) error { folder, err := getGoogleFolder(d.Id(), d, config) if err != nil { - return handleNotFoundError(err, d, d.Id()) + return handleNotFoundError(err, d, fmt.Sprintf("Folder Not Found : %s", d.Id())) } d.Set("name", folder.Name) From e6a24a23d243d93cdc8203217e684188d1cbc7e7 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Mon, 5 Aug 2019 20:08:19 +0000 Subject: [PATCH 7/7] Update tracked submodules -> HEAD on Mon Aug 5 20:08:19 UTC 2019 Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec. --- build/terraform | 2 +- build/terraform-beta | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/terraform b/build/terraform index d678d7b5ead6..72f6f7fa8cdf 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit d678d7b5ead691d62174100cdd08c2501187a5a6 +Subproject commit 72f6f7fa8cdfec8a53e7f228eba2f2b094cdab12 diff --git a/build/terraform-beta b/build/terraform-beta index 34f73a899d56..647193c245ea 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 34f73a899d56d5d182644488b3089f87c5905cf5 +Subproject commit 647193c245ea540a411708bfe86ca1c19c583a97