Skip to content

Commit

Permalink
Do not diffSuppress port when port_specification is not "US… (#3316
Browse files Browse the repository at this point in the history
…) (#5997)

* Do not diffSuppress `port` when `port_specification` is "USED_NAME_PORT"

* Formatting

* Update health_check.erb

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 27, 2020
1 parent 25522e0 commit 6b1d4f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 6b1d4f9

Please sign in to comment.