Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not diffSuppress port when port_specification is not "USED_FIXED_PORT" #5997

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3316.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: Fixed an issue where `port` could not be removed from health checks
```
5 changes: 3 additions & 2 deletions google/resource_compute_health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func healthCheckCustomizeDiff(diff *schema.ResourceDiff, v interface{}) error {
return nil
}

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

if int64(oldPort) == defaultPort && newPort == 0 {
portSpec := d.Get(b[0] + ".0.port_specification")
if int64(oldPort) == defaultPort && newPort == 0 && portSpec == "USE_FIXED_PORT" {
return true
}
}
Expand Down