Skip to content

Commit

Permalink
Mark service directory endpoint.network as immutable (#6060) (#4334)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored May 23, 2022
1 parent 2c18a62 commit d782172
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/6060.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
service-directory: marked network field immutable in `google_service_directory_endpoint`
```
11 changes: 1 addition & 10 deletions google-beta/resource_service_directory_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Metadata that goes beyond any these limits will be rejected.`,
"network": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The URL to the network, such as projects/PROJECT_NUMBER/locations/global/networks/NETWORK_NAME.`,
},
"port": {
Expand Down Expand Up @@ -232,12 +233,6 @@ func resourceServiceDirectoryEndpointUpdate(d *schema.ResourceData, meta interfa
} else if v, ok := d.GetOkExists("metadata"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, metadataProp)) {
obj["metadata"] = metadataProp
}
networkProp, err := expandServiceDirectoryEndpointNetwork(d.Get("network"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkProp)) {
obj["network"] = networkProp
}

url, err := replaceVars(d, config, "{{ServiceDirectoryBasePath}}{{name}}")
if err != nil {
Expand All @@ -258,10 +253,6 @@ func resourceServiceDirectoryEndpointUpdate(d *schema.ResourceData, meta interfa
if d.HasChange("metadata") {
updateMask = append(updateMask, "metadata")
}

if d.HasChange("network") {
updateMask = append(updateMask, "network")
}
// updateMask is a URL parameter but not present in the schema, so replaceVars
// won't set it
url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")})
Expand Down

0 comments on commit d782172

Please sign in to comment.