mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-06 18:51:13 +00:00
Add comment for create func.
Add a comment explaining why we have such wonky update logic in the create func for NS record sets.
This commit is contained in:
parent
0e2fa2e38f
commit
4a342ca8ee
@ -77,6 +77,14 @@ func resourceDnsRecordSetCreate(d *schema.ResourceData, meta interface{}) error
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need to replace NS record sets in the same call. That means
|
||||||
|
// we need to list all the current NS record sets attached to the
|
||||||
|
// zone and add them to the change as deletions. We can't just add
|
||||||
|
// new NS record sets, or we'll get an error about the NS record set
|
||||||
|
// already existing; see terraform-providers/terraform-provider-google#95.
|
||||||
|
// We also can't just remove the NS recordsets on creation, as at
|
||||||
|
// least one is required. So the solution is to "update in place" by
|
||||||
|
// putting the addition and the removal in the same API call.
|
||||||
if d.Get("type").(string) == "NS" {
|
if d.Get("type").(string) == "NS" {
|
||||||
log.Printf("[DEBUG] DNS record list request for %q", zone)
|
log.Printf("[DEBUG] DNS record list request for %q", zone)
|
||||||
res, err := config.clientDns.ResourceRecordSets.List(project, zone).Do()
|
res, err := config.clientDns.ResourceRecordSets.List(project, zone).Do()
|
||||||
|
Loading…
Reference in New Issue
Block a user