providers/mailgun: fix sending/receiving records
The Mailgun provider was relying on an old behavior of `ResourceData.Set` that would allow nested access to maps. We now just build up our own maps like sane people.
This commit is contained in:
parent
17680bb7ff
commit
86af71ad6d
|
@ -171,23 +171,25 @@ func resourceMailginDomainRetrieve(id string, client *mailgun.Client, d *schema.
|
||||||
d.Set("wildcard", resp.Domain.Wildcard)
|
d.Set("wildcard", resp.Domain.Wildcard)
|
||||||
d.Set("spam_action", resp.Domain.SpamAction)
|
d.Set("spam_action", resp.Domain.SpamAction)
|
||||||
|
|
||||||
d.Set("receiving_records", make([]interface{}, len(resp.ReceivingRecords)))
|
receivingRecords := make([]map[string]interface{}, len(resp.ReceivingRecords))
|
||||||
for i, r := range resp.ReceivingRecords {
|
for i, r := range resp.ReceivingRecords {
|
||||||
prefix := fmt.Sprintf("receiving_records.%d", i)
|
receivingRecords[i] = make(map[string]interface{})
|
||||||
d.Set(prefix+".priority", r.Priority)
|
receivingRecords[i]["priority"] = r.Priority
|
||||||
d.Set(prefix+".valid", r.Valid)
|
receivingRecords[i]["valid"] = r.Valid
|
||||||
d.Set(prefix+".value", r.Value)
|
receivingRecords[i]["value"] = r.Value
|
||||||
d.Set(prefix+".record_type", r.RecordType)
|
receivingRecords[i]["record_type"] = r.RecordType
|
||||||
}
|
}
|
||||||
|
d.Set("receiving_records", receivingRecords)
|
||||||
|
|
||||||
d.Set("sending_records", make([]interface{}, len(resp.SendingRecords)))
|
sendingRecords := make([]map[string]interface{}, len(resp.SendingRecords))
|
||||||
for i, r := range resp.SendingRecords {
|
for i, r := range resp.SendingRecords {
|
||||||
prefix := fmt.Sprintf("sending_records.%d", i)
|
sendingRecords[i] = make(map[string]interface{})
|
||||||
d.Set(prefix+".name", r.Name)
|
sendingRecords[i]["name"] = r.Name
|
||||||
d.Set(prefix+".valid", r.Valid)
|
sendingRecords[i]["valid"] = r.Valid
|
||||||
d.Set(prefix+".value", r.Value)
|
sendingRecords[i]["value"] = r.Value
|
||||||
d.Set(prefix+".record_type", r.RecordType)
|
sendingRecords[i]["record_type"] = r.RecordType
|
||||||
}
|
}
|
||||||
|
d.Set("sending_records", sendingRecords)
|
||||||
|
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue