DelegationSet is not support in private zones.

This commit is contained in:
John Engelman 2015-05-08 08:58:35 -05:00
parent bf97d6a80f
commit a51bc6007d
2 changed files with 24 additions and 18 deletions

View File

@ -70,7 +70,7 @@ func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) erro
VPCID: aws.String(v.(string)), VPCID: aws.String(v.(string)),
VPCRegion: aws.String(meta.(*AWSClient).region), VPCRegion: aws.String(meta.(*AWSClient).region),
} }
if w := d.Get("vpc_region"); w != nil { if w := d.Get("vpc_region"); w != "" {
req.VPC.VPCRegion = aws.String(w.(string)) req.VPC.VPCRegion = aws.String(w.(string))
} }
} }
@ -119,6 +119,7 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error
return err return err
} }
if zone.DelegationSet != nil {
ns := make([]string, len(zone.DelegationSet.NameServers)) ns := make([]string, len(zone.DelegationSet.NameServers))
for i := range zone.DelegationSet.NameServers { for i := range zone.DelegationSet.NameServers {
ns[i] = *zone.DelegationSet.NameServers[i] ns[i] = *zone.DelegationSet.NameServers[i]
@ -127,6 +128,9 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error
if err := d.Set("name_servers", ns); err != nil { if err := d.Set("name_servers", ns); err != nil {
return fmt.Errorf("[DEBUG] Error setting name servers for: %s, error: %#v", d.Id(), err) return fmt.Errorf("[DEBUG] Error setting name servers for: %s, error: %#v", d.Id(), err)
} }
} else {
d.Set("name_servers", nil);
}
// get tags // get tags
req := &route53.ListTagsForResourceInput{ req := &route53.ListTagsForResourceInput{

View File

@ -134,6 +134,7 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource.
return fmt.Errorf("Hosted zone err: %v", err) return fmt.Errorf("Hosted zone err: %v", err)
} }
if resp.DelegationSet != nil {
sorted_ns := make([]string, len(resp.DelegationSet.NameServers)) sorted_ns := make([]string, len(resp.DelegationSet.NameServers))
for i, ns := range resp.DelegationSet.NameServers { for i, ns := range resp.DelegationSet.NameServers {
sorted_ns[i] = *ns sorted_ns[i] = *ns
@ -146,6 +147,7 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource.
return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns) return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns)
} }
} }
}
*zone = *resp.HostedZone *zone = *resp.HostedZone
return nil return nil