Test that HTTPS health checks are supported for google_compute_backend_service.

This commit is contained in:
Riley Karson 2017-06-20 10:59:56 -07:00
parent 8bdfd3cd2f
commit f07a08bd76
2 changed files with 39 additions and 1 deletions

View File

@ -171,6 +171,27 @@ func TestAccComputeBackendService_withConnectionDrainingAndUpdate(t *testing.T)
}
}
func TestAccComputeBackendService_withHttpsHealthCheck(t *testing.T) {
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
var svc compute.BackendService
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeBackendService_withHttpsHealthCheck(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
},
})
}
func testAccCheckComputeBackendServiceDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
@ -416,3 +437,20 @@ resource "google_compute_http_health_check" "zero" {
}
`, serviceName, drainingTimeout, checkName)
}
func testAccComputeBackendService_withHttpsHealthCheck(serviceName, checkName string) string {
return fmt.Sprintf(`
resource "google_compute_backend_service" "foobar" {
name = "%s"
health_checks = ["${google_compute_https_health_check.zero.self_link}"]
protocol = "HTTPS"
}
resource "google_compute_https_health_check" "zero" {
name = "%s"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
`, serviceName, checkName)
}

View File

@ -69,7 +69,7 @@ The following arguments are supported:
* `name` - (Required) The name of the backend service.
* `health_checks` - (Required) Specifies a list of HTTP/HTTPS health checks
* `health_checks` - (Required) Specifies a list of health checks
for checking the health of the backend service. Currently at most
one health check can be specified, and a health check is required.