diff --git a/builtin/providers/aws/resource_aws_route53_zone.go b/builtin/providers/aws/resource_aws_route53_zone.go index a16a711b7..7dc6329a8 100644 --- a/builtin/providers/aws/resource_aws_route53_zone.go +++ b/builtin/providers/aws/resource_aws_route53_zone.go @@ -31,6 +31,12 @@ func resourceAwsRoute53Zone() *schema.Resource { Computed: true, }, + "delegation_set_name_servers": &schema.Schema{ + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + }, + "tags": tagsSchema(), }, } @@ -80,7 +86,7 @@ func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) erro func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error { r53 := meta.(*AWSClient).r53conn - _, err := r53.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(d.Id())}) + zone, err := r53.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(d.Id())}) if err != nil { // Handle a deleted zone if r53err, ok := err.(aws.APIError); ok && r53err.Code == "NoSuchHostedZone" { @@ -90,6 +96,8 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error return err } + d.Set("delegation_set_name_servers", zone.DelegationSet.NameServers) + // get tags req := &route53.ListTagsForResourceRequest{ ResourceID: aws.String(d.Id()), diff --git a/builtin/providers/aws/resource_aws_route53_zone_test.go b/builtin/providers/aws/resource_aws_route53_zone_test.go index 0669f88b1..a9b0225c7 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_test.go +++ b/builtin/providers/aws/resource_aws_route53_zone_test.go @@ -114,6 +114,15 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource. if err != nil { return fmt.Errorf("Hosted zone err: %v", err) } + + for i, ns := range resp.DelegationSet.NameServers { + attribute := fmt.Sprintf("delegation_set_name_servers.%d", i) + dsns := rs.Primary.Attributes[attribute] + if dsns != ns { + return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns) + } + } + *zone = *resp.HostedZone return nil }