-
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
Fix Quotas service_code
/quota_code
validation
#17992
Conversation
fe3275c
to
985c8a4
Compare
985c8a4
to
5b927c5
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.
Hi @Stretch96 , thank you for this PR! While the custom validation funcs look great and tests are fantastic, the current convention is to use the Terraform Plugin SDK's validation
package's helper methods e.g. validation.StringLenBetween()
. Apologies for not providing guidance beforehand!
So with that said, refactoring the 2 validationFuncs would be the best next step. To encompass the validation requirements we can use something like:
ValidateFunc: validation.All(
validation.StringLenBetween(1, 128),
validation.StringMatch(regexp.MustCompile(`^[A-Za-z][A-Za-z0-9-]*$`), "must begin with a letter and contain only alphanumeric or hyphen characters"),
),
ValidateFunc: validation.All(
validation.StringLenBetween(1, 63),
validation.StringMatch(regexp.MustCompile(`^[A-Za-z][A-Za-z0-9-]*$`), "must begin with a letter and contain only alphanumeric or hyphen characters"),
),
With this refactoring, the tests will no longer be needed as the validation package is unit testing in the SDK.
Reach out if you have questions :)
Cool cool, I'll refactor using those 👍 I just copied from the (I think) security group validations and tests Maybe that'll be my next PR if they need refactoring too Lol |
Hi @Stretch96 👋 , circling back here since it's been some time since my initial review. If it's possible to edit your PR, I'll try to push up the requested changes to get this into an upcoming release. If not, let me know if you'll be available to finish up the PR .. no worries if you can't at this time! |
60c1f22
to
a909c4a
Compare
a909c4a
to
7b7997a
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.
Thanks again @Stretch96 🚀 !
Output of acceptance tests:
--- SKIP: TestAccAwsServiceQuotasServiceQuota_Value_IncreaseOnCreate (0.00s)
--- SKIP: TestAccAwsServiceQuotasServiceQuota_Value_IncreaseOnUpdate (0.00s)
--- PASS: TestAccAwsServiceQuotasServiceQuotaDataSource_QuotaCode (12.99s)
--- PASS: TestAccAwsServiceQuotasServiceQuotaDataSource_QuotaName (15.00s)
--- PASS: TestAccAwsServiceQuotasServiceQuota_basic (17.13s)
This has been released in version 3.37.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
Fix Quotas
service_code
/quota_code
validationCloses #17970