terraform-provider-openstack icon indicating copy to clipboard operation
terraform-provider-openstack copied to clipboard

dns recordset/zone created in ERROR state creates invalid terraform state

Open Roukoswarf opened this issue 5 years ago • 1 comments

Terraform Version

v0.14.0

Affected Resource(s)

Please list the resources as a list, for example:

  • openstack_dns_recordset_v2
  • openstack_dns_zone_v2

terraform apply output snips

https://gist.github.com/Roukoswarf/b4c97f665e0d8db2486a262ae9121be4

Expected Behavior

State should be aware that the record was created, and is in pending state, or state should be pulled from openstack before attempting recreation, so that this can fix itself when the resource becomes active on subsequent runs.

Actual Behavior

First run fails, due to ERROR state check on zone, which in openstack represents a replication delay. Second run fails, even if the zone is now ACTIVE, as state does not reflect that it was created, and receives 409 conflict when creating an already-existing record.

Steps to Reproduce

  1. terraform apply - with openstack setting the zone into ERROR
  2. terraform apply - with the zone being ACTIVE (propagation delay resolved)

Important Factoids

Some of our dns backends have replication delay issues, which may cause ERROR states which eventually resolve themselves.

Roukoswarf avatar Dec 03 '20 23:12 Roukoswarf

Same for me:

First run fails, due to ERROR state check on zone, which in openstack represents a replication delay.

│ Error: Error waiting for openstack_dns_recordset_v2  to become active: unexpected state 'ERROR', wanted target 'ACTIVE'. last error: %!s(<nil>)

Second run fails, even if the zone is now ACTIVE, as state does not reflect that it was created, and receives 409 conflict when creating an already-existing record.

│ Error: Error creating openstack_dns_recordset_v2: Expected HTTP response code [201 202] when accessing [POST https://server:13001/v2/zones/481836f9-e84b-4db8-9777-643b6d372483/recordsets], but got 409 instead
│ {"message": "Duplicate RecordSet", "code": 409, "type": "duplicate_recordset", "request_id": "req-053a810c-e594-45cb-a372-52cf7b810207"}

philippe-granet avatar Jun 02 '22 15:06 philippe-granet