@@ -41,6 +41,37 @@ func TestAccAWSRoute53HealthCheck_basic(t *testing.T) {
4141 })
4242}
4343
44+ func TestAccAWSRoute53HealthCheck_withSearchString (t * testing.T ) {
45+ resource .Test (t , resource.TestCase {
46+ PreCheck : func () { testAccPreCheck (t ) },
47+ IDRefreshName : "aws_route53_health_check.foo" ,
48+ Providers : testAccProviders ,
49+ CheckDestroy : testAccCheckRoute53HealthCheckDestroy ,
50+ Steps : []resource.TestStep {
51+ resource.TestStep {
52+ Config : testAccRoute53HealthCheckConfigWithSearchString ,
53+ Check : resource .ComposeTestCheckFunc (
54+ testAccCheckRoute53HealthCheckExists ("aws_route53_health_check.foo" ),
55+ resource .TestCheckResourceAttr (
56+ "aws_route53_health_check.foo" , "invert_healthcheck" , "false" ),
57+ resource .TestCheckResourceAttr (
58+ "aws_route53_health_check.foo" , "search_string" , "OK" ),
59+ ),
60+ },
61+ resource.TestStep {
62+ Config : testAccRoute53HealthCheckConfigWithSearchStringUpdate ,
63+ Check : resource .ComposeTestCheckFunc (
64+ testAccCheckRoute53HealthCheckExists ("aws_route53_health_check.foo" ),
65+ resource .TestCheckResourceAttr (
66+ "aws_route53_health_check.foo" , "invert_healthcheck" , "true" ),
67+ resource .TestCheckResourceAttr (
68+ "aws_route53_health_check.foo" , "search_string" , "FAILED" ),
69+ ),
70+ },
71+ },
72+ })
73+ }
74+
4475func TestAccAWSRoute53HealthCheck_withChildHealthChecks (t * testing.T ) {
4576 resource .Test (t , resource.TestCase {
4677 PreCheck : func () { testAccPreCheck (t ) },
@@ -247,3 +278,39 @@ resource "aws_route53_health_check" "foo" {
247278 insufficient_data_health_status = "Healthy"
248279}
249280`
281+
282+ const testAccRoute53HealthCheckConfigWithSearchString = `
283+ resource "aws_route53_health_check" "foo" {
284+ fqdn = "dev.notexample.com"
285+ port = 80
286+ type = "HTTP_STR_MATCH"
287+ resource_path = "/"
288+ failure_threshold = "2"
289+ request_interval = "30"
290+ measure_latency = true
291+ invert_healthcheck = false
292+ search_string = "OK"
293+
294+ tags = {
295+ Name = "tf-test-health-check"
296+ }
297+ }
298+ `
299+
300+ const testAccRoute53HealthCheckConfigWithSearchStringUpdate = `
301+ resource "aws_route53_health_check" "foo" {
302+ fqdn = "dev.notexample.com"
303+ port = 80
304+ type = "HTTP_STR_MATCH"
305+ resource_path = "/"
306+ failure_threshold = "5"
307+ request_interval = "30"
308+ measure_latency = true
309+ invert_healthcheck = true
310+ search_string = "FAILED"
311+
312+ tags = {
313+ Name = "tf-test-health-check"
314+ }
315+ }
316+ `
0 commit comments