Merge pull request #3688 from ajvb/master

Added measure_latency option to Route 53 Health Check resource.
This commit is contained in:
Clint 2016-01-07 17:07:06 -06:00
commit 829fffce7e
2 changed files with 16 additions and 0 deletions

View File

@ -55,6 +55,12 @@ func resourceAwsRoute53HealthCheck() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
}, },
"measure_latency": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
} }
@ -128,6 +134,12 @@ func resourceAwsRoute53HealthCheckCreate(d *schema.ResourceData, meta interface{
healthConfig.ResourcePath = aws.String(v.(string)) healthConfig.ResourcePath = aws.String(v.(string))
} }
if *healthConfig.Type != route53.HealthCheckTypeCalculated {
if v, ok := d.GetOk("measure_latency"); ok {
healthConfig.MeasureLatency = aws.Bool(v.(bool))
}
}
input := &route53.CreateHealthCheckInput{ input := &route53.CreateHealthCheckInput{
CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)), CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)),
HealthCheckConfig: healthConfig, HealthCheckConfig: healthConfig,
@ -174,6 +186,7 @@ func resourceAwsRoute53HealthCheckRead(d *schema.ResourceData, meta interface{})
d.Set("ip_address", updated.IPAddress) d.Set("ip_address", updated.IPAddress)
d.Set("port", updated.Port) d.Set("port", updated.Port)
d.Set("resource_path", updated.ResourcePath) d.Set("resource_path", updated.ResourcePath)
d.Set("measure_latency", updated.MeasureLatency)
// read the tags // read the tags
req := &route53.ListTagsForResourceInput{ req := &route53.ListTagsForResourceInput{

View File

@ -20,6 +20,8 @@ func TestAccAWSRoute53HealthCheck_basic(t *testing.T) {
Config: testAccRoute53HealthCheckConfig, Config: testAccRoute53HealthCheckConfig,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"), testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"),
resource.TestCheckResourceAttr(
"aws_route53_health_check.foo", "measure_latency", "true"),
), ),
}, },
resource.TestStep{ resource.TestStep{
@ -124,6 +126,7 @@ resource "aws_route53_health_check" "foo" {
resource_path = "/" resource_path = "/"
failure_threshold = "2" failure_threshold = "2"
request_interval = "30" request_interval = "30"
measure_latency = true
tags = { tags = {
Name = "tf-test-health-check" Name = "tf-test-health-check"