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,13 +119,17 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error
return err return err
} }
ns := make([]string, len(zone.DelegationSet.NameServers)) if zone.DelegationSet != nil {
for i := range zone.DelegationSet.NameServers { ns := make([]string, len(zone.DelegationSet.NameServers))
ns[i] = *zone.DelegationSet.NameServers[i] for i := range zone.DelegationSet.NameServers {
} ns[i] = *zone.DelegationSet.NameServers[i]
sort.Strings(ns) }
if err := d.Set("name_servers", ns); err != nil { sort.Strings(ns)
return fmt.Errorf("[DEBUG] Error setting name servers for: %s, error: %#v", d.Id(), err) if err := d.Set("name_servers", ns); err != nil {
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

View File

@ -134,16 +134,18 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource.
return fmt.Errorf("Hosted zone err: %v", err) return fmt.Errorf("Hosted zone err: %v", err)
} }
sorted_ns := make([]string, len(resp.DelegationSet.NameServers)) if resp.DelegationSet != nil {
for i, ns := range resp.DelegationSet.NameServers { sorted_ns := make([]string, len(resp.DelegationSet.NameServers))
sorted_ns[i] = *ns for i, ns := range resp.DelegationSet.NameServers {
} sorted_ns[i] = *ns
sort.Strings(sorted_ns) }
for idx, ns := range sorted_ns { sort.Strings(sorted_ns)
attribute := fmt.Sprintf("name_servers.%d", idx) for idx, ns := range sorted_ns {
dsns := rs.Primary.Attributes[attribute] attribute := fmt.Sprintf("name_servers.%d", idx)
if dsns != ns { dsns := rs.Primary.Attributes[attribute]
return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns) if dsns != ns {
return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns)
}
} }
} }