mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-01 07:42:40 +00:00
Test that HTTPS health checks are supported for google_compute_backend_service.
This commit is contained in:
parent
8bdfd3cd2f
commit
f07a08bd76
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user