
terraform-aws-arc-network-firewall¶
Overview¶
SourceFuse AWS Reference Architecture (ARC) Terraform module for managing the AWS Network Firewall module.
Features¶
- Flexible Deployment: Support for both VPC-attached and Transit Gateway-attached firewalls
- Comprehensive Rule Support: Stateful and stateless rule groups with Suricata compatibility
- Advanced Logging: CloudWatch Logs, S3, and Kinesis Data Firehose integration
- Security Best Practices: Encryption, tagging, and protection settings
- High Availability: Multi-AZ deployment support
- Policy Management: Custom and AWS managed rule groups
- Conditional Resources: Smart resource creation based on configuration
- Production Ready: Comprehensive validation and error handling
Usage¶
Basic Firewall¶
Transit Gateway-Attached Firewall¶
Firewall with Resource Policy¶
Examples¶
The examples/ directory contains complete, working examples:
- basic-firewall: Simple VPC-attached firewall with minimal configuration
- firewall-with-rule-groups: Advanced firewall with custom stateful/stateless rules
- firewall-with-logging: Comprehensive logging configuration
- firewall-with-resource-policy: Firewall with cross-account resource policy
- firewall-with-rule-group-policies: Firewall with resource policies for rule groups
- firewall-with-tls-inspection: Basic TLS inspection configuration
- advanced-tls-inspection: Advanced TLS inspection with multiple certificates and KMS
- transit-gateway-firewall: Transit Gateway-attached firewall
Security Best Practices¶
- Encryption: Use customer-managed KMS keys for encryption at rest
- Logging: Enable comprehensive logging for security monitoring
- Protection Settings: Enable all protection mechanisms in production
- Rule Ordering: Use STRICT_ORDER for deterministic rule evaluation
- Least Privilege: Apply minimal required permissions for IAM roles
- Tagging: Implement consistent tagging for resource management
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.3 |
| aws | >= 5.0, < 7.0 |
Providers¶
| Name | Version |
|---|---|
| aws | 6.16.0 |
Modules¶
| Name | Source | Version |
|---|---|---|
| s3_firewall_logs | sourcefuse/arc-s3/aws | 0.0.5 |
Resources¶
| Name | Type |
|---|---|
| aws_cloudwatch_log_group.firewall_logs | resource |
| aws_networkfirewall_firewall.this | resource |
| aws_networkfirewall_firewall_policy.this | resource |
| aws_networkfirewall_logging_configuration.this | resource |
| aws_networkfirewall_resource_policy.example | resource |
| aws_networkfirewall_resource_policy.firewall_policy | resource |
| aws_networkfirewall_rule_group.this | resource |
| aws_networkfirewall_tls_inspection_configuration.this | resource |
| aws_networkfirewall_vpc_endpoint_association.this | resource |
Inputs¶
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| availability_zones | List of availability zone IDs for transit gateway-attached firewall | list(string) |
[] |
no |
| create_firewall | Controls whether the Network Firewall should be created | bool |
true |
no |
| create_firewall_policy_resource_policy | Whether to create a resource policy for the firewall policy | bool |
false |
no |
| create_rule_group_resource_policy | Whether to attach a resource policy to the Rule Group | bool |
false |
no |
| description | Description of the Network Firewall | string |
null |
no |
| firewall_config | Combined firewall settings | object({ |
{} |
no |
| firewall_policy_config | # Firewall Policy Configuration | object({ |
{} |
no |
| firewall_policy_resource_policy | Resource policy configuration for the firewall policy | object({ |
{ |
no |
| logging_config | List of logging destinations to configure. Example: [ { log_type = "FLOW" log_destination_type = "S3" log_destination_name = "firewall-logs-bucket" }, { log_type = "ALERT" log_destination_type = "CloudWatchLogs" log_destination_name = "firewall-alerts-loggroup" } ] |
object({ |
CloudWatchLogs | KinesisDataFirehose log_destination_name = string # bucket name or log group name })), []) }) |
| name | Name of the Network Firewall | string |
n/a | yes |
| rule_group_config | Complete rule group configuration in one object | object({ |
{} |
no |
| rule_group_resource_policy | IAM-style resource policy for Network Firewall Rule Group | object({ |
{ |
no |
| subnet_ids | List of subnet IDs for firewall endpoints | list(string) |
[] |
no |
| tags | Tags to apply to all resources | map(string) |
{} |
no |
| tls_inspection_configuration | TLS inspection configuration | object({ |
{} |
no |
| vpc_endpoint_association | Configuration for VPC Endpoint Association | object({ |
{} |
no |
| vpc_id | VPC ID where the firewall will be deployed | string |
null |
no |
Outputs¶
| Name | Description |
|---|---|
| arn | ARN of the rule group |
| availability_zones | Availability zones where firewall endpoints are created |
| firewall_arn | The firewall ARN |
| firewall_endpoint_ids | Map of endpoint IDs per AZ |
| firewall_id | The firewall ID |
| firewall_name | Firewall name |
| firewall_policy_arn | The Amazon Resource Name (ARN) that identifies the firewall policy |
| firewall_policy_id | The Amazon Resource Name (ARN) that identifies the firewall policy |
| firewall_policy_name | The name of the firewall policy |
| firewall_policy_resource_policy_id | ID of the firewall policy resource policy |
| firewall_policy_update_token | A string token used when updating the firewall policy |
| firewall_status | Firewall status |
| id | ID of the rule group |
| logging_configuration_id | The Amazon Resource Name (ARN) of the associated firewall for logging |
| resource_policy_ids | List of resource policy IDs |
| subnet_ids | List of subnet IDs where firewall endpoints are created |
| tags_all | All tags for the firewall |
| tls_inspection_configuration_arn | ARN of the TLS inspection configuration |
| tls_inspection_configuration_certificate_authority | Certificate authority information |
| tls_inspection_configuration_certificates | Certificates information |
| tls_inspection_configuration_id | ID of the TLS inspection configuration |
| tls_inspection_configuration_update_token | Update token of the TLS inspection configuration |
| transit_gateway_id | The Transit Gateway ID for transit gateway-attached firewall |
| update_token | Update token of the rule group |
| vpc_id | The VPC ID where the firewall is deployed |