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

redacted_fields attribute "single_header" for resource aws_wafv2_web_acl_logging_configuration does not support more than 1 item #14249

Closed jiwuh closed 4 years ago

jiwuh commented 4 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

Terraform Configuration Files

resource "aws_wafv2_web_acl_logging_configuration" "example" {
  log_destination_configs = ["${aws_kinesis_firehose_delivery_stream.example.arn}"]
  resource_arn            = "${aws_wafv2_web_acl.example.arn}"
  redacted_fields {
    single_query {
      name = "user-agent"
    }
    single_query {
      name = "authorization"
    }
  }
}

Expected Behavior

Both headers are added on the AWS console as shown below: image

Actual Behavior

An error is thrown statin that the attribute supports 1 item maximum. image

Steps to Reproduce

  1. terraform apply
anGie44 commented 4 years ago

Hi @jiwuh, thank you for creating this issue! While only one single_header attribute can be declared within a redacted_fields block, it's possible to create repeated redacted_fields blocks. With the example you've provided, you can do something like:

resource "aws_wafv2_web_acl_logging_configuration" "example" {
  log_destination_configs = ["${aws_kinesis_firehose_delivery_stream.example.arn}"]
  resource_arn            = "${aws_wafv2_web_acl.example.arn}"
  redacted_fields {
    single_header {
      name = "user-agent"
    }
  } 

  redacted_fields {
    single_header {
      name = "authorization"
    }
  }
}

Looking at the snapshot of the console, unfortunately it does look a bit different from the WAFv2 API's structure but hopefully this example helps! If any further questions arise please let me know 😃

jiwuh commented 4 years ago

That worked @anGie44. Thanks a bunch!

ghost commented 4 years ago

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.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!