-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add Support for WAFv2 Managed Rule Group Configuration #23287
Comments
Related: #23290 |
any update? |
I am sad that I am unable to integrate the ATP. Could you please progress this issue? |
+1 on sadness, please prioritize :( |
Hello everyone! Has anyone been able to solve this problem with some workaround through aws-cli for example? I tried to activate Account Takeover Prevention through Terraform with a null_resource and aws-cli, but I did not find this option in the documentation and reference examples. Thanks! |
Any update on this? =`( |
Well, meanwhile, this is my workaround (in Brazil we say "gambiarra")
resource "null_resource" "aws_wafv2_webacl_add_custom_rules" {
triggers = {
# Ensures this local-exec always ran.
timestamp = timestamp()
}
provisioner "local-exec" {
command = "./files/scripts/aws_wafv2_web_acl_add_custom_rules.sh '${aws_wafv2_web_acl.example.name}' '${aws_wafv2_web_acl.example.id}' '${aws_wafv2_web_acl.example.scope}' '${file("./files/aws_wafv2_web_acl_custom_rules.json")}'"
}
}
#!/usr/bin/env bash
WEB_ACL_NAME=$1
WEB_ACL_ID=$2
WEB_ACL_SCOPE=$3
WEB_ACL_CUSTOM_RULES=$4
# Retrieves the Web ACL document.
WEB_ACL_DOCUMENT=$(aws wafv2 get-web-acl --name $WEB_ACL_NAME --scope $WEB_ACL_SCOPE --id $WEB_ACL_ID)
# Copy Web ACL default action.
WEB_ACL_DEFAULT_ACTION=$(echo $WEB_ACL_DOCUMENT | jq '.WebACL.DefaultAction' -r)
# Copy Web ACL description.
WEB_ACL_DESCRIPTION=$(echo $WEB_ACL_DOCUMENT | jq '.WebACL.Description' -r)
# Copy Web ACL visibility config.
WEB_ACL_VISIBILITY_CONFIG=$(echo $WEB_ACL_DOCUMENT | jq '.WebACL.VisibilityConfig' -r)
# Copy Web ACL rules.
WEB_ACL_RULES=$(echo $WEB_ACL_DOCUMENT | jq '.WebACL.Rules' -r)
# Set Web ACL lock token.
WEB_ACL_LOCK_TOKEN=$(echo $WEB_ACL_DOCUMENT | jq '.LockToken' -r)
# Set Web ACL new rules.
WEB_ACL_NEW_RULES=$(jq --null-input --argjson WEB_ACL_RULES "$WEB_ACL_RULES" --argjson WEB_ACL_CUSTOM_RULES "$WEB_ACL_CUSTOM_RULES" '$WEB_ACL_RULES + $WEB_ACL_CUSTOM_RULES')
# Update the Web ACL.
OUTPUT=$(aws wafv2 update-web-acl \
--name $WEB_ACL_NAME \
--scope $WEB_ACL_SCOPE \
--id $WEB_ACL_ID \
--description "$WEB_ACL_DESCRIPTION" \
--lock-token $WEB_ACL_LOCK_TOKEN \
--default-action "$WEB_ACL_DEFAULT_ACTION" \
--visibility-config "$WEB_ACL_VISIBILITY_CONFIG" \
--rules "$WEB_ACL_NEW_RULES"
)
[
{
"Name": "AWS-AWSManagedRulesATPRuleSet",
"Priority": 3,
"Statement": {
"ManagedRuleGroupStatement": {
"VendorName": "AWS",
"Name": "AWSManagedRulesATPRuleSet",
"ManagedRuleGroupConfigs": [
{
"LoginPath": "redacted"
},
{
"PayloadType": "redacted"
},
{
"UsernameField": {
"Identifier": "redacted"
}
},
{
"PasswordField": {
"Identifier": "redacted"
}
}
]
}
},
"OverrideAction": {
"None": {}
},
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "AWS-AWSManagedRulesATPRuleSet"
}
}
]
|
you're a lifesaver @maiconbaum! Thank you. |
This functionality has been released in v4.49.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! |
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. |
Community Note
Add Support for WAFv2 Managed Rule Group Configuration
WAFv2 recently added AWS WAF Fraud Control account takeover prevention (ATP) feature as a new aws managed rule group. In order to use this managed rule group, some configuration is required to be put in, which is a new data structure that the current
aws_wafv2_rule_group
resource doesn't support.New or Affected Resource(s)
References
The text was updated successfully, but these errors were encountered: