Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vpc flow logs option to subnets #6

Merged
merged 4 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ module "vpc" {
subnet_ip = "10.10.10.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
{
subnet_name = "subnet-02"
subnet_ip = "10.10.20.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
]

Expand Down Expand Up @@ -73,6 +75,7 @@ Then perform the following commands on the root folder:
| subnets_ips | The IP and cidrs of the subnets being created |
| subnets_names | The names of the subnets being created |
| subnets_private_access | Whether the subnets will have access to Google API's without a public IP |
| subnet_flow_logs | Whether the subnets will have VPC flow logs enabled |
| subnets_regions | The region where the subnets will be created |
| subnets_secondary_ranges | The secondary ranges associated with these subnets |

Expand Down
5 changes: 5 additions & 0 deletions examples/multi_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ module "test-vpc-module-01" {
subnet_ip = "10.10.10.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
{
subnet_name = "test-network-01-subnet-02"
subnet_ip = "10.10.20.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
{
subnet_name = "test-network-01-subnet-03"
subnet_ip = "10.10.30.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
]

Expand Down Expand Up @@ -74,12 +77,14 @@ module "test-vpc-module-02" {
subnet_ip = "10.10.40.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
{
subnet_name = "test-network-02-subnet-02"
subnet_ip = "10.10.50.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
]

Expand Down
2 changes: 2 additions & 0 deletions examples/simple_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ module "test-vpc-module" {
subnet_ip = "10.10.10.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
{
subnet_name = "subnet-02"
subnet_ip = "10.10.20.0/24"
subnet_region = "us-west1"
subnet_private_access = false
subnet_flow_logs = true
},
]

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ resource "google_compute_subnetwork" "subnetwork" {
ip_cidr_range = "${lookup(var.subnets[count.index], "subnet_ip")}"
region = "${lookup(var.subnets[count.index], "subnet_region")}"
private_ip_google_access = "${lookup(var.subnets[count.index], "subnet_private_access")}"
enable_flow_logs = "${lookup(var.subnets[count.index], "subnet_flow_logs")}"
morgante marked this conversation as resolved.
Show resolved Hide resolved
network = "${google_compute_network.network.name}"
project = "${var.project_id}"

Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ output "subnets_private_access" {
description = "Whether the subnets will have access to Google API's without a public IP"
}

output "subnets_flow_logs" {
value = "${google_compute_subnetwork.subnetwork.*.enable_flow_logs}"
description = "Whether the subnets will have VPC flow logs enabled"
}

output "subnets_secondary_ranges" {
value = "${google_compute_subnetwork.subnetwork.*.secondary_ip_range}"
description = "The secondary ranges associated with these subnets"
Expand Down