Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.
$ terraform -v
Terraform v0.10.8
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
resource "digitalocean_domain" "example" {
name = "example.com"
ip_address = "1.2.3.4"
}
resource "digitalocean_record" "bar" {
domain = "${digitalocean_domain.example.name}"
count = "${length(digitalocean_droplet.droplets.*.id)}"
type = "A"
name = "${element(digitalocean_droplet.droplets.*.name, count.index)}"
ttl = 600
value = "${element(digitalocean_droplet.droplets.*.ipv4_address_private, count.index)}"
}
when i have the domain example.com with all its "A" records set and I change the ip_address of the digitalocean_domain resource, i expect all the digitalocean_record resources to be left or re-created if necessary.
when the digitalocean_domain's ip_address is changed, the entire resource is destroyed, which means all the digitalocean_record items are also lost. but the plan does not catch this and the DNS records are not re-created until a subsequent terraform run. This is not good, especially if you're not paying attention and DNS is left incomplete. :/
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
-/+ digitalocean_domain.example (new resource required)
id: "example.com" => <computed> (forces new resource)
ip_address: "1.2.3.4" => "4.5.6.7" (forces new resource)
name: "example.com" => "example.com"
Plan: 1 to add, 0 to change, 1 to destroy.
Please list the steps required to reproduce the issue, for example:
terraform applyip_addressterraform planterraform applyterraform planterrraform applyNothing special
can confirm this behavior
We've just released a change to the DO API that should facilitate fixing this. ip_address is now optional. Once Terraform is updated to reflect that, you can create the A record explicitly using digitalocean_record resource rather that automagically through the digitalocean_domain. See: https://developers.digitalocean.com/documentation/changelog/api-v2/create-domains-without-providing-an-ip-address/
I'm happy to say that yesterday, we release version 1.0.0 of the DigitalOcean Terraform provider. It should include a fix for this issue.
You can find the full changelog here: https://github.com/terraform-providers/terraform-provider-digitalocean/blob/master/CHANGELOG.md#100-september-27-2018
In order to upgrade an existing project to the latest version, run:
terraform init -upgrade
If you believe that this issue is being closed by mistake or the problem has not been resolved, please let me know or feel free to open a new issue with additional details.
Thanks for your patience!
Most helpful comment
I'm happy to say that yesterday, we release version 1.0.0 of the DigitalOcean Terraform provider. It should include a fix for this issue.
You can find the full changelog here: https://github.com/terraform-providers/terraform-provider-digitalocean/blob/master/CHANGELOG.md#100-september-27-2018
In order to upgrade an existing project to the latest version, run:
If you believe that this issue is being closed by mistake or the problem has not been resolved, please let me know or feel free to open a new issue with additional details.
Thanks for your patience!