I've created few dns_cname_record
resources, however Terraform DNS provider started to throw the errors like:
Error: update server is not set
I've created the bug report for it, as it prevents me from running any Terraform command. The error is basically shown on every Terraform command, including plan
.
Now I want to clean up and get rid of this DNS module completely, and all references to it. So I've removed all my dns_cname_record
resources from all .tf
files. However there are some still resources stored in a state file which I want to get rid of.
$ terraform show | grep -w dns_cname_record
# dns_cname_record.foo-example:
resource "dns_cname_record" "foo-example" {
# dns_cname_record.bar-example:
resource "dns_cname_record" "bar-example" {
So I've tried to destroy it with force without refreshing state, but it failed as well:
$ TF_LOG=trace terraform destroy -target=dns_cname_record.foo-example -force -refresh=false
...
[TRACE] <root>: eval: *terraform.EvalIf
[TRACE] <root>: eval: *terraform.EvalApplyProvisioners
[TRACE] <root>: eval: *terraform.EvalIf
[TRACE] <root>: eval: *terraform.EvalIf
[TRACE] <root>: eval: *terraform.EvalApply
[DEBUG] dns_cname_record.foo-example: applying the planned Delete change
[TRACE] GRPCProvider: ApplyResourceChange
[DEBUG] dns_cname_record.foo-example: apply errored, but we're indicating that via the Error pointer rather than returning it: update server is not set
[TRACE] <root>: eval: *terraform.EvalWriteState
[TRACE] EvalWriteState: writing current state object for dns_cname_record.foo-example
[TRACE] <root>: eval: *terraform.EvalApplyPost
[ERROR] <root>: eval: *terraform.EvalApplyPost, err: update server is not set
[ERROR] <root>: eval: *terraform.EvalSequence, err: update server is not set
[ERROR] <root>: eval: *terraform.EvalOpFilter, err: update server is not set
[TRACE] [walkDestroy] Exiting eval tree: dns_cname_record.foo-example (destroy)
[TRACE] vertex "dns_cname_record.foo-example (destroy)": visit complete
[TRACE] dag/walk: upstream of "dns_cname_record.foo-example (clean up state)" errored, so skipping
[TRACE] dag/walk: upstream of "provider.dns (close)" errored, so skipping
[TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
[TRACE] dag/walk: upstream of "root" errored, so skipping
Error: update server is not set
Releasing state lock. This may take a few moments...
[DEBUG] plugin: plugin process exited: path=~/.terraform/plugins/darwin_amd64/terraform-provider-dns_v2.1.1_x4 pid=76229
[DEBUG] plugin: plugin exited
and at the end, it doesn't remove invalid entry, because of the error.
I've also tried to remove terraform-provider-dns_v2.1.1_x4
binary module file, but teraform plan
complains about it, and terraform init
downloads it again, and the problem repeats.
Is there any higher power command than destroy -force -refresh=false
to get rid of the invalid entries from the state file which breaking local setup? Or I need to edit the state file manually?