Merge pull request #3945 from hashicorp/b-aws-r53-record-zone-fix

provider/aws: Fix crash in Route53 Record if Zone not found
This commit is contained in:
Clint 2015-11-17 09:10:50 -06:00
commit 2ed867b5ab
1 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,13 @@ func resourceAwsRoute53Record() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, es []error) {
value := v.(string)
if value == "" {
es = append(es, fmt.Errorf("Cannot have empty zone_id"))
}
return
},
},
"ttl": &schema.Schema{
@ -136,6 +143,9 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
if err != nil {
return err
}
if zoneRecord.HostedZone == nil {
return fmt.Errorf("[WARN] No Route53 Zone found for id (%s)", zone)
}
// Get the record
rec, err := resourceAwsRoute53RecordBuildSet(d, *zoneRecord.HostedZone.Name)