Skip to content

Commit 958e774

Browse files
Fix an edge-case in forceNewIfNetworkIPNotUpdatable function (#11653)
[upstream:a13ca6505fa3c36cab0ab4550332c76a8592ad96] Signed-off-by: Modular Magician <[email protected]>
1 parent 80388c0 commit 958e774

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.changelog/11653.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: setting `network_ip` to "" will no longer cause diff and will be treated the same as `null`
3+
```

google-beta/services/compute/resource_compute_instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func forceNewIfNetworkIPNotUpdatableFunc(d tpgresource.TerraformResourceDiff) er
146146
oldS, newS := d.GetChange(subnetworkKey)
147147
subnetworkProjectKey := prefix + ".subnetwork_project"
148148
networkIPKey := prefix + ".network_ip"
149-
if d.HasChange(networkIPKey) {
149+
if d.HasChange(networkIPKey) && d.Get(networkIPKey).(string) != "" {
150150
if tpgresource.CompareSelfLinkOrResourceName("", oldS.(string), newS.(string), nil) && !d.HasChange(subnetworkProjectKey) && tpgresource.CompareSelfLinkOrResourceName("", oldN.(string), newN.(string), nil) {
151151
if err := d.ForceNew(networkIPKey); err != nil {
152152
return err

0 commit comments

Comments
 (0)