Skip to content

Commit 7189fae

Browse files
Do not diffSuppress port when port_specification is not "US… (#3316) (#1906)
* Do not diffSuppress `port` when `port_specification` is "USED_NAME_PORT" * Formatting * Update health_check.erb Signed-off-by: Modular Magician <[email protected]>
1 parent d833ee1 commit 7189fae

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.changelog/3316.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
compute: Fixed an issue where `port` could not be removed from health checks
3+
```

google-beta/resource_compute_health_check.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func healthCheckCustomizeDiff(diff *schema.ResourceDiff, v interface{}) error {
7373
return nil
7474
}
7575

76-
func portDiffSuppress(k, old, new string, _ *schema.ResourceData) bool {
76+
func portDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
7777
b := strings.Split(k, ".")
7878
if len(b) > 2 {
7979
attr := b[2]
@@ -99,7 +99,8 @@ func portDiffSuppress(k, old, new string, _ *schema.ResourceData) bool {
9999
oldPort, _ := strconv.Atoi(old)
100100
newPort, _ := strconv.Atoi(new)
101101

102-
if int64(oldPort) == defaultPort && newPort == 0 {
102+
portSpec := d.Get(b[0] + ".0.port_specification")
103+
if int64(oldPort) == defaultPort && newPort == 0 && portSpec == "USE_FIXED_PORT" {
103104
return true
104105
}
105106
}

0 commit comments

Comments
 (0)