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:
commit
2ed867b5ab
|
@ -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