umotif-public / terraform-aws-waf-webaclv2

Terraform module to configure WAF V2 Web ACL with managed rules for Application Load Balancer
https://registry.terraform.io/modules/umotif-public/waf-webaclv2/aws
Other
137 stars 124 forks source link

Fix 'Invalid value for "inputMap" parameter: the given object has no attribute "type" #102

Closed nunofernandes closed 1 year ago

nunofernandes commented 1 year ago

The current code has a bug:

│ Error: Invalid function argument
│
│   on .terraform/modules/waf.waf/main.tf line 6111, in resource "aws_wafv2_web_acl" "main":
│ 6111:                       priority = lookup(byte_match_statement.value, "priority")
│     ├────────────────
│     │ byte_match_statement.value is object with 4 attributes
│
│ Invalid value for "inputMap" parameter: the given object has no attribute "priority".
╵
╷
│ Error: Invalid function argument
│
│   on .terraform/modules/waf.waf/main.tf line 6112, in resource "aws_wafv2_web_acl" "main":
│ 6112:                       type     = lookup(byte_match_statement.value, "type")
│     ├────────────────
│     │ byte_match_statement.value is object with 4 attributes
│
│ Invalid value for "inputMap" parameter: the given object has no attribute "type".

This happens because we need to fetch the text_transformation element of the object and not the object itself.

Description

This fixes that issue.

Ohid25 commented 1 year ago

Thank you for the fix! This is now a part of 4.6.0.