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

Fix permadiffs in regional health_checks and backend_service #4998

Merged
3 changes: 3 additions & 0 deletions mmv1/products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,9 @@ overrides: !ruby/object:Overrides::ResourceOverrides
diff_suppress_func: 'portDiffSuppress'
grpcHealthCheck: !ruby/object:Overrides::Terraform::PropertyOverride
diff_suppress_func: 'portDiffSuppress'
logConfig: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
custom_flatten: 'templates/terraform/custom_flatten/health_check_log_config.go.erb'
RegionUrlMap: !ruby/object:Overrides::Terraform::ResourceOverride
examples:
- !ruby/object:Provider::Terraform::Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,47 @@ func TestAccComputeRegionHealthCheck_tcpAndSsl_shouldFail(t *testing.T) {
})
}

func TestAccComputeRegionHealthCheck_logConfigDisabled(t *testing.T) {
t.Parallel()

hckName := fmt.Sprintf("tf-test-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputeRegionHealthCheck_logConfigDisabled(hckName),
},
{
ResourceName: "google_compute_region_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccComputeRegionHealthCheck_logConfigDisabled(hckName string) string {
return fmt.Sprintf(`
resource "google_compute_region_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "%s"
timeout_sec = 2
unhealthy_threshold = 3
http2_health_check {
port = "443"
}
log_config {
enable = false
}
}
`, hckName)
}

func testAccComputeRegionHealthCheck_tcp(hckName string) string {
return fmt.Sprintf(`
resource "google_compute_region_health_check" "foobar" {
Expand Down