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
Closed
rtokarek-fastly opened this issue
Oct 18, 2022
· 3 comments
· Fixed by GoogleCloudPlatform/magic-modules#10559, hashicorp/terraform-provider-google-beta#7305, #17989 or GoogleCloudPlatform/terraform-google-conversion#2212
Closed
Deletion of managed SOA record-sets fails on terraform destroy #12827
rtokarek-fastly opened this issue
Oct 18, 2022
· 3 comments
· Fixed by GoogleCloudPlatform/magic-modules#10559, hashicorp/terraform-provider-google-beta#7305, #17989 or GoogleCloudPlatform/terraform-google-conversion#2212
Labels
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 |
rtokarek-fastly
added a commit
to rtokarek-fastly/magic-modules
that referenced
this issue
Oct 19, 2022
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
5 tasks
PR GoogleCloudPlatform/magic-modules#6724 for GoogleCloudPlatform/magic-modules is up. |
github-actions
bot
added
forward/review
In review; remove label to forward
service/cloud-dns
labels
Dec 21, 2023
This was referenced Apr 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: