-
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/route53_zone and data-source/route53_zone: remove trailing period from name attributes #14220
Conversation
82c2362
to
44e6869
Compare
cfb923a
to
4646ede
Compare
4646ede
to
44e6869
Compare
20ce3d6
to
dfbc285
Compare
e415f07
to
b33c888
Compare
a9e1c8d
to
b5a357e
Compare
Ready for re-review :) Output of acceptance tests:
|
b5a357e
to
3ae10dd
Compare
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.
Hey @anGie44 👋 Just a few more things and this should be good to go. Thanks!
aws/resource_aws_acm_certificate.go
Outdated
// trailing period, which generates an ACM API error | ||
return strings.TrimSuffix(v.(string), ".") | ||
}, | ||
StateFunc: trimTrailingPeriod, |
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.
If the ACM API does not accept trailing periods, which if I remember correctly does not, I think our goal during this major release should be fixing up the resource to match the API expectations and return a validation error. Since we are fixing the source of the generally unexpected trailing periods by removing them from the Route 53 data sources/resources, my recommendation would be to remove the special handling like this and the custom resource logic from downstream attribute handling. I'm worried about future upkeep and harder code generation. 👍 We can add a ValidateFunc
to catch trailing periods to help catch these sooner.
(Almost)Ready-- for re-review. Just held up on test results for Output of acceptance tests with current branch state:
|
19f5c6e
to
709b581
Compare
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.
Looks good to me, let's get this in. 🚀
709b581
to
dc19585
Compare
Missed an unintended side-effect after last commit 😓 Another round of test runs returned failures in Output of acceptance tests: Previously Failing:
Re-confirmed
|
@@ -42,9 +41,12 @@ func resourceAwsRoute53Record() *schema.Resource { | |||
Required: true, | |||
ForceNew: true, | |||
StateFunc: func(v interface{}) string { | |||
value := strings.TrimSuffix(v.(string), ".") |
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.
If there are valid other places that can give this resource a trailing period, I guess we may want to walk back on adjusting this particular attribute and allow it to still handle both with and without the trailing period. I'd rather avoid changing the ACM validation record behavior since that could affect interactions with DNS systems outside of AWS.
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.
gotcha -- does seem risky in cases where that ACM attribute I changed might be used in ways not covered by our tests; i'll revert and move back this state func /remove the validation here 👍
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.
Thank you for updating the comment there, super helpful 👍
… cert computed attr val
3349867
to
9eb3147
Compare
aws/resource_aws_route53_record.go
Outdated
@@ -974,6 +977,5 @@ func parseRecordId(id string) [4]string { | |||
} | |||
} | |||
} | |||
recName = strings.TrimSuffix(recName, ".") |
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 think we can keep this here now as well (and the previous unit test case) 👍
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.
yess just discovered this one! interesting enough, i think our tests don't seem to cover a case where it would fail without this line back in b/c in TC the tests all just passed ... aside from the unit tests
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.
We would need to implement an acceptance test with a custom ImportStateIDFunc
since the ImportState
testing pulls in the ID with the trimmed value. Maybe good to have, but doesn't need to happen right now. 😄
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.
Hmm I think the TestAccAWSRoute53Record_basic_trailingPeriodAndZoneID
I most recently added should hopefully account for catching the importstateverify error ... atleast it fails when the above code is omitted :)
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 the one last thing to allow trailing period imports still, otherwise looks good and thank you for sticking through this challenging one. 🙇
OK ready to go! Re-confirmed tests in TC and separately ran ACM tests: Output:
|
This has been released in version 3.0.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! |
Community Note
Closes #13510
Closes #13010
Closes #7501
Closes #7800
Closes #6389
Closes #241
Related #1031
Release note for CHANGELOG:
Output from acceptance testing: