Skip to content

Commit

Permalink
Fix permadiffs in regional health_checks and backend_service (Goo…
Browse files Browse the repository at this point in the history
…gleCloudPlatform#4998)

Co-authored-by: upodroid <cy@borg.dev>
  • Loading branch information
upodroid authored and betsy-lichtenberg committed Apr 25, 2022
1 parent 7fc3d1a commit 5fbe126
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
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

0 comments on commit 5fbe126

Please sign in to comment.