Open molywitman opened 3 years ago
This occurred to me today, it seems to be that changing the routing policy needs to trigger a replacement of the resource and not a modification of the existing one.
Using:
$ terraform version
Terraform v1.4.6
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.7.0
Running:
$ terraform apply
# aws_route53_record.us-primary will be updated in-place
~ resource "aws_route53_record" "us-primary" {
id = "IDHERE_example.com_A_example_us_primary"
name = "example.com"
# (7 unchanged attributes hidden)
- failover_routing_policy {
- type = "PRIMARY" -> null
}
+ latency_routing_policy {
+ region = "us-east-1"
}
# (1 unchanged block hidden)
}
Emits the error:
Error: creating Route 53 Record: InvalidChangeBatch: [RRSet with DNS name example.com., type A, SetIdentifier example_us_primary, and Region Name=us-east-1 cannot be created because a non-latency RRSet with the same name and type already exists.]
│ status code: 400, request id: 9b8d701b-a46b-4075-bb7f-289afce9025c
│
│ with aws_route53_record.us-primary,
│ on route53.us.tf line 1, in resource "aws_route53_record" "us-primary":
│ 1: resource "aws_route53_record" "us-primary" {
│
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
aws_route53_record.dns_record will be updated in-place
~ resource "aws_route53_record" "dns_record" {
fqdn = "53w.tabit-dev.com"
id = "Z189Y2MAF9B0HF_53w.tabit-dev.com_A_alb"
name = "53w.tabit-dev.com"
records = []
set_identifier = "alb" -> null
ttl = 0
type = "A"
zone_id = "Z189Y2MAF9B0HF"
weighted_routing_policy {
}
}
aws_route53_record.dns_record2[0] will be destroyed
fqdn = "53w.tabit-dev.com" -> null
id = "Z189Y2MAF9B0HF_53w.tabit-dev.com_A_edge" -> null
name = "53w.tabit-dev.com" -> null
records = [] -> null
set_identifier = "edge" -> null
ttl = 0 -> null
type = "A" -> null
zone_id = "Z189Y2MAF9B0HF" -> null
alias {
}
weighted_routing_policy {
}
}
Plan: 0 to add, 1 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
Panic Output
aws_route53_record.dns_record2[0]: Destroying... [id=Z189Y2MAF9B0HF_53w.tabit-dev.com_A_edge]
aws_route53_record.dns_record: Modifying... [id=Z189Y2MAF9B0HF_53w.tabit-dev.com_A_alb]
aws_route53_record.dns_record2[0]: Still destroying... [id=Z189Y2MAF9B0HF_53w.tabit-dev.com_A_edge, 10s elapsed]
aws_route53_record.dns_record2[0]: Still destroying... [id=Z189Y2MAF9B0HF_53w.tabit-dev.com_A_edge, 20s elapsed]
aws_route53_record.dns_record2[0]: Still destroying... [id=Z189Y2MAF9B0HF_53w.tabit-dev.com_A_edge, 30s elapsed]
aws_route53_record.dns_record2[0]: Destruction complete after 35s
Error: [ERR]: Error building changeset: InvalidChangeBatch: [RRSet with DNS name 53w.tabit-dev.com., type A cannot be created as other RRSets exist with the same name and type.] status code: 400, request id: a70bdcfa-d293-4618-bb2c-524f1d0648d1
on main.tf line 41, in resource "aws_route53_record" "dns_record":
41: resource "aws_route53_record" "dns_record" {
Releasing state lock. This may take a few moments...
[terragrunt] 2020/10/19 11:45:13 Hit multiple errors:
exit status 1
Expected Behavior
The aws_route53_record" "dns_record should convert to simple
Actual Behavior
Error: [ERR]: Error building changeset: InvalidChangeBatch: [RRSet with DNS name 53w.tabit-dev.com., type A cannot be created as other RRSets exist with the same name and type.]
status code: 400, request id: a70bdcfa-d293-4618-bb2c-524f1d0648d1
Steps to Reproduce
terraform apply
Important Factoids
References
0000