Skip to content

Conversation

azadsagar
Copy link
Contributor

@azadsagar azadsagar commented Sep 24, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

This PR enhances the aws_wafv2_web_acl_rule_group_association resource by adding two new features. Since this resource provides capability to add aws managed rule groups inline, these two feature mimic the same behavior as aws_wafv2_web_acl resource.:

  • managed_rule_group_configs block in managed_rule_group:

    • Adds support for configuring additional options available for AWS managed rule groups.
  • visibility_config block at the root level: Previously, CloudWatch metrics were always enabled with the metric name hardcoded to the rule name. With this change, users can now explicitly configure:

    • Whether CloudWatch metrics are enabled.
    • The metric name (metric_name).
    • Whether sampled requests are enabled.

Relations

Closes #44419

References

managed_rule_group_configs feature is already supported in aws_wafv2_web_acl resource.

Output from Acceptance Testing

make t T=TestAccWAFV2WebACLRuleGroupAssociation_ K=wafv2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-aws_wafv2_web_acl_rule_group_association-enahancements 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/wafv2/... -v -count 1 -parallel 20 -run='TestAccWAFV2WebACLRuleGroupAssociation_'  -timeout 360m -vet=off
2025/09/24 13:31:01 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/24 13:31:01 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_basic
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_basic
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_withVisibilityConfig
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_withVisibilityConfig
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_disappears
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_disappears
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideAction
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideAction
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverride
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverride
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverrideUpdate
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverrideUpdate
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_priorityUpdate
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_priorityUpdate
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideActionUpdate
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideActionUpdate
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleNameRequiresReplace
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleNameRequiresReplace
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_webACLARNRequiresReplace
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_webACLARNRequiresReplace
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_basic
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_basic
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_withVersion
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_withVersion
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ruleActionOverride
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ruleActionOverride
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_basic
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_basic
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ACFPRuleSet
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ACFPRuleSet
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_AntiDDoSRuleSet
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_AntiDDoSRuleSet
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ATPRuleSet
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ATPRuleSet
=== RUN   TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_BotControl
=== PAUSE TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_BotControl
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_basic
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_webACLARNRequiresReplace
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ACFPRuleSet
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideActionUpdate
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ATPRuleSet
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ruleActionOverride
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_AntiDDoSRuleSet
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_basic
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_basic
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_withVersion
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleNameRequiresReplace
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverrideUpdate
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_priorityUpdate
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideAction
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverride
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_disappears
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_withVisibilityConfig
=== CONT  TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_BotControl
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_withVersion (83.46s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ruleActionOverride (94.56s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_BotControl (98.19s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_disappears (102.57s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_basic (106.70s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideAction (111.47s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverride (115.73s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_basic (116.80s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_withVisibilityConfig (119.83s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_overrideActionUpdate (135.96s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_webACLARNRequiresReplace (145.88s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ACFPRuleSet (164.48s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_ATPRuleSet (175.95s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_AntiDDoSRuleSet (185.87s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleNameRequiresReplace (190.77s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_ruleActionOverrideUpdate (192.70s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_RuleGroupReference_priorityUpdate (195.56s)
--- PASS: TestAccWAFV2WebACLRuleGroupAssociation_ManagedRuleGroup_ManagedRuleGroupConfig_basic (213.63s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/wafv2	220.447s

Copy link
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/wafv2 Issues and PRs that pertain to the wafv2 service. size/XL Managed by automation to categorize the size of a PR. labels Sep 24, 2025
@azadsagar azadsagar marked this pull request as ready for review September 24, 2025 10:05
@azadsagar azadsagar requested a review from a team as a code owner September 24, 2025 10:05
@azadsagar
Copy link
Contributor Author

Let me know if anything is needed from my side to help move this PR forward.

@azadsagar
Copy link
Contributor Author

Hello @hc-github-team-terraform-aws - let me know if you need any help reviewing this pull request or what it might take to get it on your radar. Thank you! ❤️

@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 30, 2025
@azadsagar
Copy link
Contributor Author

Hi @justinretzolk , Let me know if you need any inputs reviewing this PR, Thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/wafv2 Issues and PRs that pertain to the wafv2 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_wafv2_web_acl_rule_group_association - add managed_rule_group_configs feature for managed_rule_group and option to configure visibility_config
4 participants