-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Terraform apply does not delete Route53 record set while it says 'Resources: 1 added, 0 changed, 1 destroyed.' #9024
Comments
I have exactly the same issue, I need to delete the records manually after, otherwise i can have issues where i try to recreate it, but it already exists... |
Adding some detail from my observation of this. I changed the domain that the records resided in, not sure if that has any relevance. terraform version
|
Adding my observation too. Terraform Version
Affected Resource(s)
Steps to Reproduce
Expected Behaviordelete first route53 record (foo.my.foobar.example.com.) Debug Outputbefore
terraform v0.11.14 looks correct
|
Hi, |
Hi, |
and work also on: |
I am also experiencing this issue, where old records are not deleted. In my case it also seems to not check if a record already exists under that name before updating the zone. As a result, it will write over records, including ones that were not managed by Terraform or leftover records from the deletion issue. |
I am experiencing this issue as well. I was able to work around the issue by using the lifecycle hook in my records. |
I did more testing around the writing over existing records behavior that I had observed. It doesn't actually update existing records, it deletes them, then creates a new record on top. This is obviously quite dangerous, because if you accidentally tell Terraform to create a new record with the same name as an old one, you will temporarily not have a record for that domain name. With the workaround @NurSpass suggested ( My theory is that Terraform, without |
I created pull request #9965 We might be able to avoid this issue to use not I confirmed the following. I try printf debugging on findRecord as below when i := 0
for {
pt, file, line, ok := runtime.Caller(i)
if !ok {
break
}
funcName := runtime.FuncForPC(pt).Name()
log.Printf("file=%s, line=%d, func=%v\n", file, line, funcName)
i += 1
}
before_name, after_name := d.GetChange("name")
log.Printf("id=%s zone_id=%s name=%s change_name=%s,%s fqdn=%s type=%s\n", d.Id(), d.Get("zone_id"), d.Get("name"), before_name, after_name, d.Get("fqdn"), d.Get("type")) then print as below
I think it may not be right that But I'm not sure, so create workaroud pull request. |
also affected:
|
The same issue with Route53 record deletion:
|
The fix for this has been merged and will release with version 2.69.0 of the Terraform AWS Provider, likely tomorrow. Thanks to @jbergknoff-rival for the implementation. 👍 |
This has been released in version 2.69.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
I have updated a Route53 record Set which needed the resource replacement. I get a success message from terraform apply for the same. But looking at Route 53 in AWS, i can see that the new record set was created but the old one was not deleted.
# aws_route53_record.recordSet must be replaced
$ terraform apply -input=false "planfile"
aws_route53_record.recordSet: Destroying... [id=xxxxxxxxxxx]
aws_route53_record.recordSet: Destruction complete after 1s
aws_route53_record.recordSet: Creating...
aws_route53_record.recordSet: Still creating... [10s elapsed]
aws_route53_record.recordSet: Still creating... [20s elapsed]
aws_route53_record.recordSet: Still creating... [30s elapsed]
aws_route53_record.recordSet: Creation complete after 38s [id=xxxxxxxxxxx]
Apply complete! Resources: 1 added, 0 changed, 1 destroyed.
The text was updated successfully, but these errors were encountered: