provider/aws: no weight for all set_identifier

This commit is contained in:
Luke Amdor 2015-11-12 14:57:41 -06:00
parent 9426f6ff6c
commit 10ca0559ae
2 changed files with 61 additions and 1 deletions

View File

@ -417,7 +417,10 @@ func resourceAwsRoute53RecordBuildSet(d *schema.ResourceData, zoneName string) (
if v, ok := d.GetOk("set_identifier"); ok {
rec.SetIdentifier = aws.String(v.(string))
rec.Weight = aws.Int64(int64(d.Get("weight").(int)))
}
if v, ok := d.GetOk("weight"); ok {
rec.Weight = aws.Int64(int64(v.(int)))
}
return rec, nil

View File

@ -122,6 +122,23 @@ func TestAccAWSRoute53Record_wildcard(t *testing.T) {
})
}
func TestAccAWSRoute53Record_failover(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRoute53RecordDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccRoute53FailoverCNAMERecord,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53RecordExists("aws_route53_record.www-primary"),
testAccCheckRoute53RecordExists("aws_route53_record.www-secondary"),
),
},
},
})
}
func TestAccAWSRoute53Record_weighted(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -384,6 +401,46 @@ resource "aws_route53_record" "default" {
}
`
const testAccRoute53FailoverCNAMERecord = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_health_check" "foo" {
fqdn = "dev.notexample.com"
port = 80
type = "HTTP"
resource_path = "/"
failure_threshold = "2"
request_interval = "30"
tags = {
Name = "tf-test-health-check"
}
}
resource "aws_route53_record" "www-primary" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "www"
type = "CNAME"
ttl = "5"
failover = "PRIMARY"
health_check_id = "${aws_route53_health_check.foo.id}"
set_identifier = "www-primary"
records = ["primary.notexample.com"]
}
resource "aws_route53_record" "www-secondary" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "www"
type = "CNAME"
ttl = "5"
failover = "SECONDARY"
set_identifier = "www-secondary"
records = ["secondary.notexample.com"]
}
`
const testAccRoute53WeightedCNAMERecord = `
resource "aws_route53_zone" "main" {
name = "notexample.com"