From b7fcc4b81ecc7386a60f16ae7010d97927e1e357 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 13 Dec 2024 12:14:46 -0800 Subject: [PATCH] Revert "Etag support for ACM service perimeters" (#12568) (#8911) [upstream:87f392596aa1431322e8f341011561e171e2329f] Signed-off-by: Modular Magician --- .changelog/12568.txt | 3 ++ ...ccess_context_manager_service_perimeter.go | 39 ------------------- ..._context_manager_service_perimeter_test.go | 1 - ...cess_context_manager_service_perimeters.go | 23 ----------- ...xt_manager_service_perimeter.html.markdown | 5 --- ...t_manager_service_perimeters.html.markdown | 6 --- 6 files changed, 3 insertions(+), 74 deletions(-) create mode 100644 .changelog/12568.txt diff --git a/.changelog/12568.txt b/.changelog/12568.txt new file mode 100644 index 0000000000..304b4d9d3c --- /dev/null +++ b/.changelog/12568.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +accesscontextmanager: added `etag` to `google_access_context_manager_service_perimeter` and `google_access_context_manager_service_perimeters` (reverts) +``` \ No newline at end of file diff --git a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter.go b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter.go index 1a6d817d8f..82ab977eb9 100644 --- a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter.go +++ b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter.go @@ -909,13 +909,6 @@ bet set to True if any of the fields in the spec are set to non-default values.` Computed: true, Description: `Time the AccessPolicy was created in UTC.`, }, - "etag": { - Type: schema.TypeString, - Computed: true, - Description: `An opaque identifier for the current version of the ServicePerimeter. This -identifier does not follow any specific format. If an etag is not provided, the -operation will be performed as if a valid etag is provided.`, - }, "update_time": { Type: schema.TypeString, Computed: true, @@ -970,12 +963,6 @@ func resourceAccessContextManagerServicePerimeterCreate(d *schema.ResourceData, } else if v, ok := d.GetOkExists("use_explicit_dry_run_spec"); !tpgresource.IsEmptyValue(reflect.ValueOf(useExplicitDryRunSpecProp)) && (ok || !reflect.DeepEqual(v, useExplicitDryRunSpecProp)) { obj["useExplicitDryRunSpec"] = useExplicitDryRunSpecProp } - etagProp, err := expandAccessContextManagerServicePerimeterEtag(d.Get("etag"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("etag"); !tpgresource.IsEmptyValue(reflect.ValueOf(etagProp)) && (ok || !reflect.DeepEqual(v, etagProp)) { - obj["etag"] = etagProp - } parentProp, err := expandAccessContextManagerServicePerimeterParent(d.Get("parent"), d, config) if err != nil { return err @@ -1121,9 +1108,6 @@ func resourceAccessContextManagerServicePerimeterRead(d *schema.ResourceData, me if err := d.Set("use_explicit_dry_run_spec", flattenAccessContextManagerServicePerimeterUseExplicitDryRunSpec(res["useExplicitDryRunSpec"], d, config)); err != nil { return fmt.Errorf("Error reading ServicePerimeter: %s", err) } - if err := d.Set("etag", flattenAccessContextManagerServicePerimeterEtag(res["etag"], d, config)); err != nil { - return fmt.Errorf("Error reading ServicePerimeter: %s", err) - } if err := d.Set("name", flattenAccessContextManagerServicePerimeterName(res["name"], d, config)); err != nil { return fmt.Errorf("Error reading ServicePerimeter: %s", err) } @@ -1171,12 +1155,6 @@ func resourceAccessContextManagerServicePerimeterUpdate(d *schema.ResourceData, } else if v, ok := d.GetOkExists("use_explicit_dry_run_spec"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, useExplicitDryRunSpecProp)) { obj["useExplicitDryRunSpec"] = useExplicitDryRunSpecProp } - etagProp, err := expandAccessContextManagerServicePerimeterEtag(d.Get("etag"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("etag"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, etagProp)) { - obj["etag"] = etagProp - } obj, err = resourceAccessContextManagerServicePerimeterEncoder(d, meta, obj) if err != nil { @@ -1218,21 +1196,12 @@ func resourceAccessContextManagerServicePerimeterUpdate(d *schema.ResourceData, if d.HasChange("use_explicit_dry_run_spec") { updateMask = append(updateMask, "useExplicitDryRunSpec") } - - if d.HasChange("etag") { - updateMask = append(updateMask, "etag") - } // updateMask is a URL parameter but not present in the schema, so ReplaceVars // won't set it url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) if err != nil { return err } - if _, ok := d.GetOkExists("etag"); ok { - updateMask = append(updateMask, "etag") - - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - } // err == nil indicates that the billing_project value was found if bp, err := tpgresource.GetBillingProject(d, config); err == nil { @@ -2116,10 +2085,6 @@ func flattenAccessContextManagerServicePerimeterUseExplicitDryRunSpec(v interfac return v } -func flattenAccessContextManagerServicePerimeterEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimeterName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } @@ -3208,10 +3173,6 @@ func expandAccessContextManagerServicePerimeterUseExplicitDryRunSpec(v interface return v, nil } -func expandAccessContextManagerServicePerimeterEtag(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - func expandAccessContextManagerServicePerimeterParent(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } diff --git a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go index 8f02128efa..15ba715aa5 100644 --- a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go +++ b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go @@ -28,7 +28,6 @@ func testAccAccessContextManagerServicePerimeter_basicTest(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccAccessContextManagerServicePerimeter_basic(org, "my policy", "level", "perimeter"), - Check: resource.TestCheckResourceAttrSet("google_access_context_manager_service_perimeter.test-access", "etag"), }, { ResourceName: "google_access_context_manager_service_perimeter.test-access", diff --git a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeters.go b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeters.go index 06c49f554d..6284f9b2dc 100644 --- a/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeters.go +++ b/google-beta/services/accesscontextmanager/resource_access_context_manager_service_perimeters.go @@ -715,13 +715,6 @@ bet set to True if any of the fields in the spec are set to non-default values.` Computed: true, Description: `Time the AccessPolicy was created in UTC.`, }, - "etag": { - Type: schema.TypeString, - Computed: true, - Description: `An opaque identifier for the current version of the ServicePerimeter. This -identifier does not follow any specific format. If an etag is not provided, the -operation will be performed as if a valid etag is provided.`, - }, "update_time": { Type: schema.TypeString, Computed: true, @@ -1123,7 +1116,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimeters(v interface{} "perimeter_type": flattenAccessContextManagerServicePerimetersServicePerimetersPerimeterType(original["perimeterType"], d, config), "status": flattenAccessContextManagerServicePerimetersServicePerimetersStatus(original["status"], d, config), "spec": flattenAccessContextManagerServicePerimetersServicePerimetersSpec(original["spec"], d, config), - "etag": flattenAccessContextManagerServicePerimetersServicePerimetersEtag(original["etag"], d, config), "use_explicit_dry_run_spec": flattenAccessContextManagerServicePerimetersServicePerimetersUseExplicitDryRunSpec(original["useExplicitDryRunSpec"], d, config), }) } @@ -1144,10 +1136,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersName(v interfa return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } @@ -1951,13 +1939,6 @@ func expandAccessContextManagerServicePerimetersServicePerimeters(v interface{}, transformed["description"] = transformedDescription } - transformedEtag, err := expandAccessContextManagerServicePerimetersServicePerimetersEtag(original["etag"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedEtag); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["etag"] = transformedEtag - } - transformedCreateTime, err := expandAccessContextManagerServicePerimetersServicePerimetersCreateTime(original["create_time"], d, config) if err != nil { return nil, err @@ -2017,10 +1998,6 @@ func expandAccessContextManagerServicePerimetersServicePerimetersDescription(v i return v, nil } -func expandAccessContextManagerServicePerimetersServicePerimetersEtag(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - func expandAccessContextManagerServicePerimetersServicePerimetersCreateTime(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } diff --git a/website/docs/r/access_context_manager_service_perimeter.html.markdown b/website/docs/r/access_context_manager_service_perimeter.html.markdown index d3f65bb46a..77081f9ea1 100644 --- a/website/docs/r/access_context_manager_service_perimeter.html.markdown +++ b/website/docs/r/access_context_manager_service_perimeter.html.markdown @@ -860,11 +860,6 @@ In addition to the arguments listed above, the following computed attributes are * `update_time` - Time the AccessPolicy was updated in UTC. -* `etag` - - An opaque identifier for the current version of the ServicePerimeter. This - identifier does not follow any specific format. If an etag is not provided, the - operation will be performed as if a valid etag is provided. - ## Timeouts diff --git a/website/docs/r/access_context_manager_service_perimeters.html.markdown b/website/docs/r/access_context_manager_service_perimeters.html.markdown index ed446be346..9e05bf9462 100644 --- a/website/docs/r/access_context_manager_service_perimeters.html.markdown +++ b/website/docs/r/access_context_manager_service_perimeters.html.markdown @@ -119,12 +119,6 @@ The following arguments are supported: Description of the ServicePerimeter and its use. Does not affect behavior. -* `etag` - - (Output) - An opaque identifier for the current version of the ServicePerimeter. This - identifier does not follow any specific format. If an etag is not provided, the - operation will be performed as if a valid etag is provided. - * `create_time` - (Output) Time the AccessPolicy was created in UTC.