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.75k stars 9.11k forks source link

[Bug]: aws_networkfirewall_logging_configuration fails to apply 3 log destination configs #38917

Open AJD-UK opened 1 month ago

AJD-UK commented 1 month ago

Terraform Core Version

0.13.4

AWS Provider Version

5.63.0

Affected Resource(s)

Expected Behavior

Alert, Flow and TLS log types should be configured

Actual Behavior

Only 2 of the 3 log types can ever be configured in any combination

Relevant Error/Panic Output Snippet

operation error Network Firewall: UpdateLoggingConfiguration, https response error StatusCode: 400, RequestID: hex, InvalidRequestException: Given logging configuration attempts to create/modify multiple log destination configs

Terraform Configuration Files

resource "aws_networkfirewall_logging_configuration" "this" {
  firewall_arn = aws_networkfirewall_firewall.anfw.arn
  logging_configuration {
    log_destination_config {
      log_destination = {
        logGroup = aws_cloudwatch_log_group.anfw_alert_log_group.name
      }
      log_destination_type = "CloudWatchLogs"
      log_type             = "ALERT"
    }
    log_destination_config {
      log_destination = {
        logGroup = aws_cloudwatch_log_group.anfw_flow_log_group.name
      }
      log_destination_type = "CloudWatchLogs"
      log_type             = "FLOW"
    }
    log_destination_config {
      log_destination = {
        logGroup = aws_cloudwatch_log_group.anfw_tls_log_group.name
      }
      log_destination_type = "CloudWatchLogs"
      log_type             = "TLS"
    }
  }
}

Steps to Reproduce

terraform apply with 3 log types defined

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-aws/issues/38790 https://github.com/hashicorp/terraform-provider-aws/pull/38824

Would you like to implement a fix?

No

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

erikvdijk88 commented 3 weeks ago

It seems a fix was done in :https://github.com/hashicorp/terraform-provider-aws/pull/38824 But after testing I get a different error now:

peration error Network Firewall: UpdateLoggingConfiguration, https response error StatusCode: 400, RequestID: 7ae56df8-f29a-4fc5-b0f9-2a99c16a3bcd, InvalidRequestException: Given logging configuration attempts to create/modify multiple log destination configs

it seems you can have all 3 logs configured on 1 network firewall with terraform. (alert, flow and tls). when you only add 2 configs (in any order) it works as expected.

AJD-UK commented 1 week ago

lorodoes can you spot anything related to PR https://github.com/hashicorp/terraform-provider-aws/pull/38824 that could cause this?