Open fathom-aniket opened 1 month ago
Hi @fathom-aniket!
According to the error message REDACTED.com is already registered
specifies that a resource with this domain_name
was already created and it is not possible to create another with the same name, even if you deleted it from tfstate
file.
As you can see in terraform registry is published an alert about this resource, implying that if a resource with the same domain_name
was previously created, it will not be deleted but abandoned, which also means that if a domain_name
was previously used for any reason, even considering errors, testing, among other possible actions, a new one should be used.
You can read more about it in this link on how to handle these situations.
Hello @ggtisc and thank you for your response!
​​According to the error message REDACTED.com is already registered specifies that a resource with this domain_name was already created and it is not possible to create another with the same name, even if you deleted it from tfstate file.
The error message is not the core issue, but is the result of the actual issue (see Actual and Expected Behavior).
The core issue is that:
REDACTED.com is already registered
error message on creation.The expected behavior would be that the GCP API should not return a different order of the name servers or doing so should not trigger a replacement. Please let me know if something is unclear, thanks!
Confirmed issue!
In this example we need to use a set instead of a list, but it looks like we need to fix it.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.6.3 on linux_amd64
Affected Resource(s)
google_clouddomains_registration
Terraform Configuration
Debug Output
Expected Behavior
The GCP API keeps reordering the returned order of the name servers. This should not cause replacement of the resource.
Additionally, the resource cannot be recreated easily due to the nature of domains.
Actual Behavior
It tries to delete and recreate the domain registration which fails due to the domain already existing.
Every time this happens, we have to manually edit the tf state to re-add the resource and change the ordering of the name servers to match what the API is now suddenly returning. We then change the terraform code to order the name servers to match the state + GCP API.
This inevitably breaks again and we have to redo this.
Steps to reproduce
Important Factoids
We use cdktf python to generate terraform resources. With the following package versions:
References
No response
b/356441102