provider/aws: Downcase Route 53 record names in statefile
This commit is contained in:
parent
7a24da8c94
commit
d798042475
|
@ -28,6 +28,10 @@ func resourceAwsRoute53Record() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
StateFunc: func(v interface{}) string {
|
||||
value := v.(string)
|
||||
return strings.ToLower(value)
|
||||
},
|
||||
},
|
||||
|
||||
"fqdn": &schema.Schema{
|
||||
|
@ -242,6 +246,8 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
|
|||
StartRecordType: aws.String(d.Get("type").(string)),
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] List resource records sets for zone: %s, opts: %s",
|
||||
zone, lopts)
|
||||
resp, err := conn.ListResourceRecordSets(lopts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -251,7 +257,7 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
|
|||
found := false
|
||||
for _, record := range resp.ResourceRecordSets {
|
||||
name := cleanRecordName(*record.Name)
|
||||
if FQDN(name) != FQDN(*lopts.StartRecordName) {
|
||||
if FQDN(strings.ToLower(name)) != FQDN(strings.ToLower(*lopts.StartRecordName)) {
|
||||
continue
|
||||
}
|
||||
if strings.ToUpper(*record.Type) != strings.ToUpper(*lopts.StartRecordType) {
|
||||
|
@ -279,6 +285,7 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
|
|||
}
|
||||
|
||||
if !found {
|
||||
log.Printf("[DEBUG] No matching record found for: %s, removing from state file", en)
|
||||
d.SetId("")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue