-
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
New resource r/aws_wafv2_rule_group #12677
Conversation
7840c68
to
2000577
Compare
hi @pvanbuijtene 👋 -- dropping a note here to rebase and isolate the resource changes when you get a chance :) |
64341b8
to
638dc61
Compare
@anGie44 it's rebased. |
// The value is returned in lower case by the API. | ||
// Trying to solve it with StateFunc and/or DiffSuppressFunc resulted in hash problem of the rule field or didn't work. | ||
validateWafv2StringIsLowerCase(), | ||
), |
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 validation is needed here (validateWafv2StringIsLowerCase
) for case, we should use the validation
package's StringMatch
(see #11872 for related tech-debt efforts to stray from custom fns)
e.g.
validation.StringMatch(regexp.MustCompile(`^[a-z]+$`), "must contain only lowercase alpha characters"),
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.
let's keep this validatonfunc but slightly adjust the message to include "lowercase"
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.
@pvanbuijtene last note ^^ to adjust the error message that will appear in the output
// The value is returned in lower case by the API. | ||
// Trying to solve it with StateFunc and/or DiffSuppressFunc resulted in hash problem of the rule field or didn't work. | ||
validateWafv2StringIsLowerCase(), | ||
), |
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.
same comment as above
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.
@pvanbuijtene last note ^^ to adjust the error message that will appear in the output
@pvanbuijtene thanks again for this PR! please find some additional comments above :) |
638dc61
to
c291a0f
Compare
25c4fbc
to
cb9f385
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.
Just some minor comments re: validation messages, otherwise LGTM @pvanbuijtene!
Output of acceptance tests:
--- PASS: TestAccAwsWafv2RuleGroup_Disappears (155.13s)
--- PASS: TestAccAwsWafv2RuleGroup_Minimal (203.12s)
--- PASS: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement (227.23s)
--- PASS: TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement (227.50s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeNameForceNew (358.05s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew (360.83s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew (361.10s)
--- PASS: TestAccAwsWafv2RuleGroup_XssMatchStatement (393.38s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement (396.52s)
--- PASS: TestAccAwsWafv2RuleGroup_SizeConstraintStatement (398.77s)
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement (407.44s)
--- PASS: TestAccAwsWafv2RuleGroup_Basic (408.00s)
--- PASS: TestAccAwsWafv2RuleGroup_SqliMatchStatement (410.37s)
--- PASS: TestAccAwsWafv2RuleGroup_Tags (427.96s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction (453.51s)
--- PASS: TestAccAwsWafv2RuleGroup_LogicalRuleStatements (454.33s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch (580.12s)
cb9f385
to
aa66fa6
Compare
@anGie44 missed those, thanks for the reminder |
hi @pvanbuijtene, i think the messaging is almost there 😅 just that we still need reference to the number and hyphen characters as you had it previously: |
aa66fa6
to
43237d8
Compare
@anGie44 went a bit too fast there, it's corrected. |
no worries @pvanbuijtene, thank you for the update! |
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.
Excellent work, @pvanbuijtene and @anGie44 🚀 (We don't typically want dynamic schema generation as a pattern that may propagate to other resources, but in this case it is practically unavoidable without full on code generation. 😄 )
Output from acceptance testing:
--- PASS: TestAccAwsWafv2RuleGroup_Disappears (139.67s)
--- PASS: TestAccAwsWafv2RuleGroup_Minimal (197.18s)
--- PASS: TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement (227.26s)
--- PASS: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement (232.16s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeNameForceNew (352.74s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew (358.60s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew (361.48s)
--- PASS: TestAccAwsWafv2RuleGroup_XssMatchStatement (394.44s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement (399.69s)
--- PASS: TestAccAwsWafv2RuleGroup_SizeConstraintStatement (400.45s)
--- PASS: TestAccAwsWafv2RuleGroup_SqliMatchStatement (401.30s)
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement (402.20s)
--- PASS: TestAccAwsWafv2RuleGroup_Basic (408.86s)
--- PASS: TestAccAwsWafv2RuleGroup_Tags (426.98s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction (449.06s)
--- PASS: TestAccAwsWafv2RuleGroup_LogicalRuleStatements (451.42s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch (577.91s)
This has been released in version 2.66.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 #11175
Relates #11046
This PR can not be merged before #12119 #12284 are merged because of copied code for testing purpose.
Release note for CHANGELOG:
Output from acceptance testing:
There's a lot of code required for testing
IpSetRefStatement
andRegexPatternSetRefStatement
, this was the only way I could make it work, maybe/hope there's an other way to simplify it.The code for
aws_wafv2_ip_set
andaws_wafv2_regex_pattern_set
is included for the tests, this should be removed after their PRs are merged.The field
statement
is recursive this is implemented with a maximum of 3 levels, more levels had a serious performance impact resulting in long test runs. I don't know if this impact is only during testing or if it also impacts run time.