Skip to content

Commit

Permalink
provider/aws: Fix crash in Route53 Record if Zone not found
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Nov 16, 2015
1 parent 6cb5ce2 commit 8400e60
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions builtin/providers/aws/resource_aws_route53_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8400e60

Please sign in to comment.