Skip to content

Commit c0effa9

Browse files
benjaminvalienteBenjamin Valiente (Contractor)
andauthored
feat: adding vpc flow logs support to main vpc module (#267)
Co-authored-by: Benjamin Valiente (Contractor) <benjamin.valiente@thoughtbot.com>
1 parent b63322c commit c0effa9

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

aws/network/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module "network" {
9191
| <a name="input_enable_flow_logs"></a> [enable\_flow\_logs](#input\_enable\_flow\_logs) | Set to true to enable VPC flow logs | `bool` | `false` | no |
9292
| <a name="input_enable_ipv6"></a> [enable\_ipv6](#input\_enable\_ipv6) | Set to false to disable IPV6 | `bool` | `false` | no |
9393
| <a name="input_enable_public_ip_on_launch"></a> [enable\_public\_ip\_on\_launch](#input\_enable\_public\_ip\_on\_launch) | Set to true to auto-assign IP addresses in public subnets | `bool` | `false` | no |
94+
| <a name="input_flow_logs_retention_days"></a> [flow\_logs\_retention\_days](#input\_flow\_logs\_retention\_days) | Number of days to retain VPC Flow Logs in CloudWatch. | `number` | `null` | no |
9495
| <a name="input_name"></a> [name](#input\_name) | Name for this network | `string` | n/a | yes |
9596
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Prefix to be applied to created resources | `list(string)` | `[]` | no |
9697
| <a name="input_nat_availability_zones"></a> [nat\_availability\_zones](#input\_nat\_availability\_zones) | Availability zones in which NAT should be provided | `list(string)` | n/a | yes |

aws/network/main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ module "vpc" {
22
count = var.create_vpc ? 1 : 0
33
source = "./modules/vpc"
44

5-
cidr_block = var.vpc_cidr_block
6-
enable_flow_logs = var.enable_flow_logs
7-
enable_ipv6 = var.enable_ipv6
8-
name = var.name
9-
namespace = var.namespace
10-
tags = local.vpc_tags
5+
cidr_block = var.vpc_cidr_block
6+
enable_flow_logs = var.enable_flow_logs
7+
enable_ipv6 = var.enable_ipv6
8+
name = var.name
9+
namespace = var.namespace
10+
tags = local.vpc_tags
11+
flow_logs_retention_days = var.flow_logs_retention_days
1112
}
1213

1314
data "aws_vpc" "this" {

aws/network/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,9 @@ variable "vpc_tags" {
9494
description = "Tags to be applied to the VPC"
9595
default = {}
9696
}
97+
98+
variable "flow_logs_retention_days" {
99+
description = "Number of days to retain VPC Flow Logs in CloudWatch." # Only applies when enable_flow_logs is true.
100+
type = number
101+
default = null # null = retain forever
102+
}

0 commit comments

Comments
 (0)