-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deletion of managed SOA record-sets fails on terraform destroy #12827
Deletion of managed SOA record-sets fails on terraform destroy #12827
Comments
A PR is here: |
I closed #12828 as I believe this needs to be changed in the relevant MagicModules code here instead: https://github.com/GoogleCloudPlatform/magic-modules/blob/276f1c70094bafdf5c5d66e09330a4755f985776/mmv1/third_party/terraform/resources/resource_dns_record_set.go#L339-L357 |
When trying to delete record-sets that are managed by terraform, some record types can't be deleted by DNS and API restrictions. (It doesn't make sense to delete the Start Of Authority (SOA) or root-level NS records by themselves as they're fundamental to the zone construct – their value can be changed, but they must exist for the zone itself to exist.) The code previously only pretended deletes for root-level NS records. This change adds SOA to that behavior so that terraform delete/destroy can function properly when SOA is managed. See issue hashicorp/terraform-provider-google#12827
PR GoogleCloudPlatform/magic-modules#6724 for GoogleCloudPlatform/magic-modules is up. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
type = "SOA"
Terraform Configuration Files
Debug Output
terraform apply
output is not applicable. That succeeds just fine. The trouble isterraform destroy
. The debug output is uninteresting, but can be provided if somebody really wants.Expected Behavior
Because the SOA record is fundamental to the zone, a
destroy
ordelete
operation should fake deletion – the same as for root-level NS records. The SOA gets deleted when the zone resource is deleted, but because we're managing the SOA record content, we run into a problem when destroying. Terraform wants to delete the managed SOA record before deleting the zone. The google cloud DNS apis properly deny deletion, but the underlying terraform go code shouldn't even try. It's not appropriate in this case.Actual Behavior
The problem is here:
terraform-provider-google/google/resource_dns_record_set.go
Lines 339 to 357 in 06ee238
The simple solution is to add to the check for NS record type to also check for SOA
if d.Get("type").(string) == "NS" || d.Get("type").(string) == "SOA" {
A PR that does this, updates the comment, and updates debug log is forthcoming.
Steps to Reproduce
project_id
to that.terraform init
terraform apply
terraform destroy
Observe the error on step 5.
The text was updated successfully, but these errors were encountered: