Skip to content

Commit

Permalink
send empty value for [region]healthcheck description (#4082) (#7500)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 12, 2020
1 parent 0c0b5ed commit b46f695
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/4082.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed ability to clear `description` field on `google_compute_health_check` and `google_compute_region_health_check`
```
4 changes: 2 additions & 2 deletions google/resource_compute_health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{})
descriptionProp, err := expandComputeHealthCheckDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
} else if v, ok := d.GetOkExists("description"); ok || !reflect.DeepEqual(v, descriptionProp) {
obj["description"] = descriptionProp
}
healthyThresholdProp, err := expandComputeHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
Expand Down Expand Up @@ -880,7 +880,7 @@ func resourceComputeHealthCheckUpdate(d *schema.ResourceData, meta interface{})
descriptionProp, err := expandComputeHealthCheckDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
} else if v, ok := d.GetOkExists("description"); ok || !reflect.DeepEqual(v, descriptionProp) {
obj["description"] = descriptionProp
}
healthyThresholdProp, err := expandComputeHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
Expand Down
1 change: 0 additions & 1 deletion google/resource_compute_health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func testAccComputeHealthCheck_tcp_update(hckName string) string {
return fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource updated for Terraform acceptance testing"
healthy_threshold = 10
name = "health-test-%s"
timeout_sec = 2
Expand Down
4 changes: 2 additions & 2 deletions google/resource_compute_region_health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ func resourceComputeRegionHealthCheckCreate(d *schema.ResourceData, meta interfa
descriptionProp, err := expandComputeRegionHealthCheckDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
} else if v, ok := d.GetOkExists("description"); ok || !reflect.DeepEqual(v, descriptionProp) {
obj["description"] = descriptionProp
}
healthyThresholdProp, err := expandComputeRegionHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
Expand Down Expand Up @@ -813,7 +813,7 @@ func resourceComputeRegionHealthCheckUpdate(d *schema.ResourceData, meta interfa
descriptionProp, err := expandComputeRegionHealthCheckDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
} else if v, ok := d.GetOkExists("description"); ok || !reflect.DeepEqual(v, descriptionProp) {
obj["description"] = descriptionProp
}
healthyThresholdProp, err := expandComputeRegionHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
Expand Down
1 change: 0 additions & 1 deletion google/resource_compute_region_health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ func testAccComputeRegionHealthCheck_tcp_update(hckName string) string {
return fmt.Sprintf(`
resource "google_compute_region_health_check" "foobar" {
check_interval_sec = 3
description = "Resource updated for Terraform acceptance testing"
healthy_threshold = 10
name = "health-test-%s"
timeout_sec = 2
Expand Down

0 comments on commit b46f695

Please sign in to comment.