hashicorp/terraform-provider-aws

AWS network firewall: Ability to attach a firewall policy to a firewall within the same resource

Open

#25,352 opened on Jun 15, 2022

 (4 comments) (2 reactions) (0 assignees)Go (10,310 forks)github user discovery
enhancementgood first issuenew-resourceservice/networkfirewall

Repository metrics

Stars
 (11,045 stars)
PR merge metrics
 (PR metrics pending)

Description

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Primary feature request - For AWS network firewall provider, need the ability to attach a firewall policy to an existing firewall within the same resource. For example, while using TF to create a firewall policy, include an option to provide the firewall ARN/ID to which this firewall policy needs to be attached

New or Affected Resource(s)

Resource: aws_networkfirewall_firewall Resource: aws_networkfirewall_firewall_policy

Potential Terraform Configuration

Option to specify firewall ID/ARN in the firewall policy resource as follows -

resource "aws_networkfirewall_firewall_policy" "fw-policy" {
  name = "fw-policy"
  firewall_policy {
    stateless_default_actions = ["aws:forward_to_sfe"]
    stateless_fragment_default_actions = ["aws:forward_to_sfe"]
    stateful_rule_group_reference {
      #priority     = 255
      resource_arn = aws_networkfirewall_rule_group.fw-rg-sful.arn
    }
    stateful_engine_options { 
      rule_order = "DEFAULT_ACTION_ORDER"
    }
  }
  firewall_arn = aws_networkfirewall_firewall.fw.arn
}

References

An existing example is when creating a security group rule, we have the option to specify the security group id.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule#example-usage

Similar FR - https://github.com/hashicorp/terraform-provider-aws/issues/25351

Contributor guide