pulumi-aws
pulumi-aws copied to clipboard
WAFv2 creation with Go - Error creating WAFv2 WebACL
Looking to get started with building a Waf v2 using the Go pulumi Library. Started to look at the code examples for Go from the page https://www.pulumi.com/docs/reference/pkg/aws/wafv2/webacl/. When trying to execute the examples from the page, I get an error which relates to the "action" and "defaultAction" fields.
Steps to reproduce
To recreate the problems, build a new pulumi project and copy the code from the page into main.go
. Running a pulumi up -y
gives the errors:
" aws:wafv2:WebAcl (example): error: 1 error occurred: * Error creating WAFv2 WebACL: InvalidParameter: 1 validation error(s) found. - missing required field, CreateWebACLInput.DefaultAction. " And also
"aws:wafv2:RuleGroup (example): error: 1 error occurred: * Error creating WAFv2 RuleGroup: WAFInvalidParameterException: Error reason: You have used none or multiple values for a field that requires exactly one value., field: RULE_ACTION, parameter: RuleAction(block=null, allow=null, count=null) { RespMetadata: { StatusCode: 400, RequestID: "e1328aa8-2720-47f6-b8ee-144e773a63f9" }, Field: "RULE_ACTION", Message_: "Error reason: You have used none or multiple values for a field that requires exactly one value., field: RULE_ACTION, parameter: RuleAction(block=null, allow=null, count=null)", Parameter: "RuleAction(block=null, allow=null, count=null)", Reason: "You have used none or multiple values for a field that requires exactly one value." } " Attached below are two screenshots displaying the errors described above:
and
This is preventing creation of a Waf v2 in AWS.
@Graham-Beer
While the example from https://pulumi.com/docs does indeed fail, the example can be fixed with a couple of small tweaks:
- Replace
OverrideAction: &wafv2.WebAclRuleOverrideActionArgs{
Count: nil,
},
with
OverrideAction: &wafv2.WebAclRuleOverrideActionArgs{
Count: &wafv2.WebAclRuleOverrideActionCountArgs{},
},
- Replace
DefaultAction: &wafv2.WebAclDefaultActionArgs{
Allow: nil,
},
with
DefaultAction: &wafv2.WebAclDefaultActionArgs{
Allow: &wafv2.WebAclDefaultActionAllowArgs{},
},
You should be able to successfully execute pulumi up
at this point.