Skip to content

Commit

Permalink
Revert "Etag support for ACM service perimeters" (#12568) (#8911)
Browse files Browse the repository at this point in the history
[upstream:87f392596aa1431322e8f341011561e171e2329f]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and c2thorn committed Dec 13, 2024
1 parent d408dc5 commit b7fcc4b
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 74 deletions.
3 changes: 3 additions & 0 deletions .changelog/12568.txt
Original file line number Diff line number Diff line change
@@ -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)
```
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
})
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b7fcc4b

Please sign in to comment.