-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
resource/aws_route53_record: Suppress uppercase alias name diff #3119
resource/aws_route53_record: Suppress uppercase alias name diff #3119
Conversation
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.
Just few comments, but nothing major.
aws/resource_aws_route53_record.go
Outdated
if strings.ToLower(old) == strings.ToLower(new) { | ||
return true | ||
} | ||
return false |
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.
The whole function can be reduced to a single line:
return strings.ToLower(old) == strings.ToLower(new)
😉
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.
💯 good catch
@@ -968,6 +1005,36 @@ resource "aws_elb" "main" { | |||
} | |||
` | |||
|
|||
const testAccRoute53ElbAliasRecordUppercase = ` | |||
resource "aws_route53_zone" "main" { | |||
name = "notexample.com" |
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.
I know other zones are static (so far), but can you randomize the name here, please? We can address others in a separate PR in the future.
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.
You got it
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.
Ha! You'll love this. We actually hardcode it in the exists/destroy functions too: https://github.com/terraform-providers/terraform-provider-aws/blob/b-aws_route53_record-alias-name-diffsuppressfunc/aws/resource_aws_route53_record_test.go#L586
Its all or nothing 👎 -- I will get that nitpick merged though 👍
This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Closes #361
Closes #439
Closes #1005
Uppercase ALB/ELB names generate an uppercase
dns_name
attribute from AWS which is subsequently saved into Terraform. When these are used for alias Route53 records, Route53 normalizes these to lowercase and only returns the lowercase value. Most folks have used the workaround (myself included) of usingname = "${lower(aws_elb.X.dns_name)}"
.I do not believe a state migration should be necessary for this change since uppercase name would have always generated the perpetual diff with the hash and name attribute itself.
Previously:
Passes local testing for me: