-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add etag to service perimeter dry run resource (#12795)
- Loading branch information
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...tes/terraform/post_read/access_context_manager_service_perimeter_dry_run_resource.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if err := d.Set("etag", res["etag"]); err != nil { | ||
log.Printf("[ERROR] Unable to set etag: %s", err) | ||
} |
16 changes: 16 additions & 0 deletions
16
...es/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
obj["use_explicit_dry_run_spec"] = true | ||
|
||
etag := d.Get("etag").(string) | ||
|
||
if etag == "" { | ||
log.Printf("[ERROR] Unable to get etag: %s", err) | ||
return nil | ||
} | ||
obj["etag"] = etag | ||
|
||
// updateMask is a URL parameter but not present in the schema, so ReplaceVars | ||
// won't set it | ||
updateMask := []string{"spec.resources", "etag"} | ||
url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) | ||
if err != nil { | ||
return err | ||
} |