Fixed up measure_latency option in r53 health checks.

* Added ignoring of param when Type is CALCULATED
* Added ForceNew param to measure_latency item in schema
* Added check to test
This commit is contained in:
AJ Bahnken 2015-10-29 12:50:02 -07:00
parent c1bb852390
commit ab273bb2ee
2 changed files with 7 additions and 2 deletions

View File

@ -59,6 +59,7 @@ func resourceAwsRoute53HealthCheck() *schema.Resource {
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
Default: false, Default: false,
ForceNew: true,
}, },
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
@ -133,8 +134,10 @@ func resourceAwsRoute53HealthCheckCreate(d *schema.ResourceData, meta interface{
healthConfig.ResourcePath = aws.String(v.(string)) healthConfig.ResourcePath = aws.String(v.(string))
} }
if v, ok := d.GetOk("measure_latency"); ok { if *healthConfig.Type != route53.HealthCheckTypeCalculated {
healthConfig.MeasureLatency = aws.Bool(v.(bool)) if v, ok := d.GetOk("measure_latency"); ok {
healthConfig.MeasureLatency = aws.Bool(v.(bool))
}
} }
input := &route53.CreateHealthCheckInput{ input := &route53.CreateHealthCheckInput{

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{