provider/aws: Fix crash in Route53 Record if Zone not found
This commit is contained in:
parent
901e5fbf9f
commit
1413d032ee
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue