Skip to content
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

r/aws_wafv2: Add missing values to text_transformation argument #20564

Merged
merged 4 commits into from
Aug 19, 2021

Conversation

jackbatzner
Copy link
Contributor

@jackbatzner jackbatzner commented Aug 13, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #20545. Add missing values to text_transformation argument for aws_wafv2_web_acl and aws_wafv2_rule_group resources

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/wafv2 Issues and PRs that pertain to the wafv2 service. labels Aug 13, 2021
@jackbatzner jackbatzner changed the title r/aws_wafv2: Add all possible text transformation values r/aws_wafv2: Add missing text_transformation values Aug 13, 2021
@jackbatzner jackbatzner changed the title r/aws_wafv2: Add missing text_transformation values r/aws_wafv2: Add missing values to text_transformation argument Aug 13, 2021
Copy link
Member

@breathingdust breathingdust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Brunhil! Thanks for the contribution, just a couple of small changes and it LGTM!

@@ -382,6 +382,21 @@ func wafv2TextTransformationSchema() *schema.Schema {
wafv2.TextTransformationTypeLowercase,
wafv2.TextTransformationTypeNone,
wafv2.TextTransformationTypeUrlDecode,
wafv2.TextTransformationTypeBase64Decode,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in (#14601) the aws-go-sdk has added _Values() suffixed const arrays so we can actually replace this whole statement with:

validation.StringInSlice(wafv2.TextTransformationType_Values(), false),

This way the validation will automatically update as we update aws-go-sdk versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Thanks for this tidbit of info, super slick. Will get this updated shortly!

Comment on lines 523 to 525
* `type` - (Required) The transformation to apply, you can specify the following types: `NONE`, `COMPRESS_WHITE_SPACE`, `HTML_ENTITY_DECODE`, `LOWERCASE`, `CMD_LINE`, `URL_DECODE`, `BASE64_DECODE`, `HEX_DECODE`, `MD5`, `REPLACE_COMMENTS`,
`ESCAPE_SEQ_DECODE`, `SQL_HEX_DECODE`, `CSS_DECODE`, `JS_DECODE`, `NORMALIZE_PATH`, `NORMALIZE_PATH_WIN`, `REMOVE_NULLS`, `REPLACE_NULLS`, `BASE64_DECODE_EXT`, `URL_DECODE_UNI`, `UTF8_TO_UNICODE`.
See the [documentation](https://docs.aws.amazon.com/waf/latest/APIReference/API_TextTransformation.html) for more details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are now using on the TextTransformation_Values() function, we should link to the TextTransformation documentation for specific values.

Suggested change
* `type` - (Required) The transformation to apply, you can specify the following types: `NONE`, `COMPRESS_WHITE_SPACE`, `HTML_ENTITY_DECODE`, `LOWERCASE`, `CMD_LINE`, `URL_DECODE`, `BASE64_DECODE`, `HEX_DECODE`, `MD5`, `REPLACE_COMMENTS`,
`ESCAPE_SEQ_DECODE`, `SQL_HEX_DECODE`, `CSS_DECODE`, `JS_DECODE`, `NORMALIZE_PATH`, `NORMALIZE_PATH_WIN`, `REMOVE_NULLS`, `REPLACE_NULLS`, `BASE64_DECODE_EXT`, `URL_DECODE_UNI`, `UTF8_TO_UNICODE`.
See the [documentation](https://docs.aws.amazon.com/waf/latest/APIReference/API_TextTransformation.html) for more details.
* `type` - (Required) The transformation to apply, please refer to the Text Transformation [documentation](https://docs.aws.amazon.com/waf/latest/APIReference/API_TextTransformation.html) for more details.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Aug 18, 2021
@breathingdust
Copy link
Member

LGTM 🚀

Verified Acceptance Tests in us-west-2

make testacc TESTARGS='-run=TestAccAwsWafv2WebACL_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsWafv2WebACL_ -timeout 180m

--- PASS: TestAccAwsWafv2WebACL_minimal (32.46s)
--- PASS: TestAccAwsWafv2WebACL_disappears (36.71s)
--- PASS: TestAccAwsWafv2WebACL_Update_rule (70.53s)
--- PASS: TestAccAwsWafv2WebACL_RateBased_maxNested (70.73s)
--- PASS: TestAccAwsWafv2WebACL_IPSetReference_basic (81.35s)
--- PASS: TestAccAwsWafv2WebACL_tags (84.90s)
--- PASS: TestAccAwsWafv2WebACL_ManagedRuleGroup_basic (87.94s)
--- PASS: TestAccAwsWafv2WebACL_RateBased_forwardedIPConfig (90.28s)
--- PASS: TestAccAwsWafv2WebACL_RateBased_basic (95.37s)
--- PASS: TestAccAwsWafv2WebACL_Update_nameForceNew (99.56s)
--- PASS: TestAccAwsWafv2WebACL_GeoMatch_forwardedIPConfig (101.44s)
--- PASS: TestAccAwsWafv2WebACL_Custom_requestHandling (109.64s)
--- PASS: TestAccAwsWafv2WebACL_Custom_response (111.87s)
--- PASS: TestAccAwsWafv2WebACL_RuleGroupReference_basic (121.12s)
--- PASS: TestAccAwsWafv2WebACL_GeoMatch_basic (134.42s)
--- PASS: TestAccAwsWafv2WebACL_Operators_maxNested (137.16s)
--- PASS: TestAccAwsWafv2WebACL_Update_ruleProperties (138.10s)
--- PASS: TestAccAwsWafv2WebACL_basic (146.87s)
--- PASS: TestAccAwsWafv2WebACL_IPSetReference_forwardedIPConfig (152.73s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	156.462s

make testacc TESTARGS='-run=TestAccAwsWafv2RuleGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsWafv2RuleGroup_ -timeout 180m
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement (66.88s)
--- PASS: TestAccAwsWafv2RuleGroup_SizeConstraintStatement (72.83s)
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement_ForwardedIPConfig (82.54s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction (82.85s)
--- PASS: TestAccAwsWafv2RuleGroup_Disappears (19.80s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement (90.30s)
--- PASS: TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement (91.64s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction_CustomResponse (95.92s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction_CustomRequestHandling (98.03s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew (98.13s)
--- PASS: TestAccAwsWafv2RuleGroup_basic (103.31s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew (35.36s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRuleProperties (110.51s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRule (36.78s)
--- PASS: TestAccAwsWafv2RuleGroup_XssMatchStatement (121.14s)
--- PASS: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement (125.86s)
--- PASS: TestAccAwsWafv2RuleGroup_LogicalRuleStatements (133.49s)
--- PASS: TestAccAwsWafv2RuleGroup_Tags (138.62s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeNameForceNew (156.07s)
--- PASS: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement_IPSetForwardedIPConfig (177.77s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch (187.36s)
--- PASS: TestAccAwsWafv2RuleGroup_SqliMatchStatement (231.49s)
--- PASS: TestAccAwsWafv2RuleGroup_Minimal (237.17s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	240.339s

@breathingdust breathingdust merged commit 018f423 into hashicorp:main Aug 19, 2021
@github-actions github-actions bot added this to the v3.55.0 milestone Aug 19, 2021
@github-actions
Copy link

This functionality has been released in v3.55.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/wafv2 Issues and PRs that pertain to the wafv2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_wafv2_web_acl does not support all available text_transformation types
4 participants