i am running terraform for my aws insfrastructure, the current aws provided configured…
Private research annotation
Sign in to add a private research label or note.
- User
i am running terraform for my aws insfrastructure, the current aws provided configured does not support WAF ACFP rules but i need one. so i have created the acfp rule manually, now i would like to incorporate into my terraform code so i does get deleted when running terraform apply. I am using the terraform module: https://github.com/umotif-public/terraform-aws-waf-webaclv2/
and my code related to the rules looks like:
module "waf-webaclv2" { #source = "../../../modules//terraform-aws-waf-webaclv2"
name_prefix = "eco-bb-alb" alb_arn = aws_lb.bb.arn allow_default_action = true create_alb_association = true
rules = [
WhitelistRuleSet
{ name = "WhiteListRuleSet" priority = "0"
action = "allow"
visibility_config = { cloudwatch_metrics_enabled = true metric_name = "URLWhiteListRuleSet-metric" sampled_requests_enabled = true }
regex_pattern_set_reference_statement = { arn = aws_wafv2_regex_pattern_set.url_whitelist.arn field_to_match = { uri_path = "{}" } priority = 0 type = "LOWERCASE" } } how can i add the rule added manually? the json file of the rule i created manually looks like: { "Name": "AWS-AWSManagedRulesACFPRuleSet", "Priority": 6, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesACFPRuleSet", "ScopeDownStatement": { "ByteMatchStatement": { "SearchString": "/api/auth/v1/companies/", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "CONTAINS" } }, "ManagedRuleGroupConfigs": [ { "AWSManagedRulesACFPRuleSet": { "CreationPath": "/api/auth/v1/companies/.", "RegistrationPagePath": "/api/auth/v1/companies/.", "RequestInspection": { "PayloadType": "JSON" }, "EnableRegexInPath": true } } ] } }, "OverrideAction": { "Count": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesACFPRuleSet" } }
Assistant
- User
i need to use the data resource with the given rule
Assistant
You're right, using a data source is the best approach if you want to reference the existing ACFP rule in your Terraform code without recreating it.
Here's how you can use a data source to fetch information about your existing ACFP rule and incorporate it into your
terraform-aws-waf-webaclv2module:terraform
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.