hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

[New Data Source]: WAFv2 Managed Rule Version #34069

Open sombrerosheep opened 1 year ago

sombrerosheep commented 1 year ago

Description

I would like terraform data sources for versions of Managed WafV2 Rule Groups. Internally, we managed a WAF terraform module which applies several of the Managed rule groups; This will help us identify when these versions change by getting caught in a terraform plan.

The only want to obtain the versions for a managed rule group is via the CLI. AWS provides documentation for setting up notifications (based on a SNS topic). Using either of these to track version changes is a bit cumbersome and requires additional technology outside of terraform. When omitting a version, a "current default" is assumed but the version diff is not see in a terraform plan. This means a terraform plan does not give the full picture of "what changed" which has resulted in some outages in my organization. With a data source we could return an error on plan instead of waiting for an apply for an error, or worse an outage from an unseen change.

I would like to be able to use a data resource for these in two possible scenarios:

These API's exist in the aws-sdk-go-v2 so adding these data sources would be straight forward.

Requested Resource(s) and/or Data Source(s)

Potential Terraform Configuration

data aws_wafv2_managed_rule_group_current_default_version "latest_version" {
    vendor_name    = "AWS"
    group_name     = "AWSManagedRulesCommonRuleSet"
    scope          = "REGIONAL"
}

data aws_wafv2_managed_rule_group_version "my_pinned_version" {
    vendor_name    = "AWS"
    group_name     = "AWSManagedRulesCommonRuleSet"
    scope          = "REGIONAL"
    version        = "Version_1.7"
}

References

Would you like to implement a fix?

Yes

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue