You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform CLI and Terraform AWS Provider Version
12.26
Affected Resource(s)
aws_route53
Terraform Configuration Files
resource"aws_route53_record""test_dns_record" {
zone_id ="XXXXXXXXXXXX"
name ="test"
type ="A"
ttl ="300"
records = ["8.8.8.8"]
}
then change to e.g.
resource"aws_route53_record""test_changed_name_dns_record" {
zone_id ="XXXXXXXXXXXX"
name ="test"
type ="A"
ttl ="300"
records = ["8.8.8.8"]
}
Debug Output
# aws_route53_record.test1_dns_record will be created+resource"aws_route53_record""test1_dns_record" {
+ allow_overwrite = (knownafterapply)
+ fqdn = (knownafterapply)
+ id = (knownafterapply)
+ name ="test"+ records = [
+"8.8.8.8",
]
+ ttl =300+ type ="A"+ zone_id ="XXXXXXXXXXXX"
}
# aws_route53_record.test_dns_record will be destroyed-resource"aws_route53_record""test_dns_record" {
- fqdn ="test.domain.fqdm"->null- id ="XXXXXXXXXXXX"->null- name ="test"->null- records = [
-"8.8.8.8",
] ->null- ttl =300->null- type ="A"->null- zone_id ="XXXXXXXXXXXX"->null
}
Plan:1 to add, 0 to change, 1 to destroy.Do you want to perform these actions?
Terraform will perform the actions described above.Only 'yes' will be accepted to approve.Enter a value: yes
aws_route53_record.test_dns_record: Destroying... [id=XXXXXXXXXXXX_test_A]
aws_route53_record.test1_dns_record: Creating...
aws_route53_record.test_dns_record: Still destroying... [id=XXXXXXXXXXXX_test_A, 10s elapsed]
aws_route53_record.test_dns_record: Still destroying... [id=XXXXXXXXXXXX_test_A, 20s elapsed]
aws_route53_record.test_dns_record: Still destroying... [id=XXXXXXXXXXXX_test_A, 30s elapsed]
aws_route53_record.test_dns_record: Destruction complete after 32s
Error: [ERR]: Error building changeset: InvalidChangeBatch: [Tried to create resource record set [name='test.domain.fqdm', type='A'] but it already exists]
status code:400, request id: 2788df36-5022-4b9d-9984-dc68c2e1e64c```
### Expected Behavior
Resource recreated
### Actual Behavior
Resource destroyed, not recreated
### Steps to Reproduce
Create aws_route53_record resource, apply
Rename that aws_route53_record's name, apply
The text was updated successfully, but these errors were encountered:
@Deku-shrub Thanks for raising this issue.
As the new resource has a new name, Terraform will treat the old and new resources as being independent and will act on them in parallel, destroying the old R53 record and creating the new in parallel and effectively a race condition is being hit.
See https://discuss.hashicorp.com/t/destroy-before-create/3980 for some details.
The way I would approach such a resource renaming would be to use the terraform state mv CLI command to rename the resource in state and then rename in the HCL code.
Community Note
Terraform CLI and Terraform AWS Provider Version
12.26
Affected Resource(s)
Terraform Configuration Files
then change to e.g.
Debug Output
The text was updated successfully, but these errors were encountered: