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
Delete old Route53 record when updating name #11335
Delete old Route53 record when updating name #11335
Conversation
@@ -1394,7 +1470,7 @@ resource "aws_route53_record" "alias" { | |||
|
|||
resource "aws_elb" "main" { | |||
name = "foobar-terraform-elb-%s" | |||
availability_zones = ["us-west-2a"] | |||
availability_zones = slice(data.aws_availability_zones.available.names, 0, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handful of tests was hardcoded to us-west-2 and can only pass in that region. This updates them to work in other regions, which I needed in order to post the full acceptance test output.
@bflad bump when you have time. This would be helpful so we don't have to manually clean up records. Thank you! |
Is this a fix for #9024? |
Ah, yes, have seen it referenced on that issue |
Oh goodness, this resource needs to be refactored to make more sense. Thank you for fixing this, @jbergknoff-rival!
Output from acceptance testing:
--- PASS: TestAccAWSRoute53Record_Alias_Elb (180.35s)
--- PASS: TestAccAWSRoute53Record_Alias_S3 (171.16s)
--- PASS: TestAccAWSRoute53Record_Alias_Uppercase (215.76s)
--- PASS: TestAccAWSRoute53Record_Alias_VpcEndpoint (523.96s)
--- PASS: TestAccAWSRoute53Record_AliasChange (260.40s)
--- PASS: TestAccAWSRoute53Record_allowOverwrite (226.43s)
--- PASS: TestAccAWSRoute53Record_basic (144.66s)
--- PASS: TestAccAWSRoute53Record_basic_fqdn (146.16s)
--- PASS: TestAccAWSRoute53Record_caaSupport (150.70s)
--- PASS: TestAccAWSRoute53Record_disappears (130.35s)
--- PASS: TestAccAWSRoute53Record_disappears_MultipleRecords (183.50s)
--- PASS: TestAccAWSRoute53Record_empty (201.91s)
--- PASS: TestAccAWSRoute53Record_failover (185.00s)
--- PASS: TestAccAWSRoute53Record_generatesSuffix (173.50s)
--- PASS: TestAccAWSRoute53Record_geolocation_basic (255.41s)
--- PASS: TestAccAWSRoute53Record_latency_basic (146.36s)
--- PASS: TestAccAWSRoute53Record_longTXTrecord (158.31s)
--- PASS: TestAccAWSRoute53Record_multivalue_answer_basic (247.80s)
--- PASS: TestAccAWSRoute53Record_NameChange (306.27s)
--- PASS: TestAccAWSRoute53Record_SetIdentifierChange (219.03s)
--- PASS: TestAccAWSRoute53Record_spfSupport (169.50s)
--- PASS: TestAccAWSRoute53Record_txtSupport (137.39s)
--- PASS: TestAccAWSRoute53Record_TypeChange (200.09s)
--- PASS: TestAccAWSRoute53Record_underscored (147.19s)
--- PASS: TestAccAWSRoute53Record_weighted_alias (330.82s)
--- PASS: TestAccAWSRoute53Record_weighted_basic (165.71s)
--- PASS: TestAccAWSRoute53Record_weighted_to_simple_basic (222.40s)
--- PASS: TestAccAWSRoute53Record_wildcard (193.78s)
@@ -1376,6 +1448,10 @@ resource "aws_route53_record" "ap-northeast-1" { | |||
` | |||
|
|||
const testAccRoute53RecordConfigAliasElb = ` | |||
data "aws_availability_zones" "available" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add Local Zone filtering post-merge for all these.
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 If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
If one updates the name of a Route53 record, it will show up in the plan as if the resource will be destroyed and then a new resource created in its place, but it actually leaves the old resource alone. This makes it difficult to refactor Route53 record resources if there will be any name collisions, because the old records can violate uniqueness constraints.
This PR adds a test which fails on the master branch, demonstrating the buggy behavior, and it updates the R53
findRecord
function to handle this case correctly and make the test pass.Community Note
Closes #9024
Release note for CHANGELOG:
Output from acceptance testing: