diff --git a/.changelog/4082.txt b/.changelog/4082.txt new file mode 100644 index 00000000000..36162f12fae --- /dev/null +++ b/.changelog/4082.txt @@ -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` +``` diff --git a/google/resource_compute_health_check.go b/google/resource_compute_health_check.go index a4bee6997b4..82498ea56c7 100644 --- a/google/resource_compute_health_check.go +++ b/google/resource_compute_health_check.go @@ -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) @@ -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) diff --git a/google/resource_compute_health_check_test.go b/google/resource_compute_health_check_test.go index 2faf9407868..30e19178ed9 100644 --- a/google/resource_compute_health_check_test.go +++ b/google/resource_compute_health_check_test.go @@ -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 diff --git a/google/resource_compute_region_health_check.go b/google/resource_compute_region_health_check.go index e1173441cd6..cd6d4d2f7ce 100644 --- a/google/resource_compute_region_health_check.go +++ b/google/resource_compute_region_health_check.go @@ -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) @@ -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) diff --git a/google/resource_compute_region_health_check_test.go b/google/resource_compute_region_health_check_test.go index a0623957031..86676071874 100644 --- a/google/resource_compute_region_health_check_test.go +++ b/google/resource_compute_region_health_check_test.go @@ -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