Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Merge branch 'fix/45-remove-enable-flow-logs' of https://github.com/c…
Browse files Browse the repository at this point in the history
…raigedmunds/terraform-google-network into craigedmunds-fix/45-remove-enable-flow-logs
  • Loading branch information
robmorgan committed Apr 2, 2020
2 parents c52b7d2 + 0a02677 commit b58bfd4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
20 changes: 18 additions & 2 deletions modules/vpc-network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ resource "google_compute_subnetwork" "vpc_subnetwork_public" {
)
}

enable_flow_logs = var.enable_flow_logging
dynamic "log_config" {
for_each = var.log_config == null ? [] : list(var.log_config)

content {
aggregation_interval = var.log_config.aggregation_interval
flow_sampling = var.log_config.flow_sampling
metadata = var.log_config.metadata
}
}
}

resource "google_compute_router_nat" "vpc_nat" {
Expand Down Expand Up @@ -101,7 +109,15 @@ resource "google_compute_subnetwork" "vpc_subnetwork_private" {
)
}

enable_flow_logs = var.enable_flow_logging
dynamic "log_config" {
for_each = var.log_config == null ? [] : list(var.log_config)

content {
aggregation_interval = var.log_config.aggregation_interval
flow_sampling = var.log_config.flow_sampling
metadata = var.log_config.metadata
}
}
}

# ---------------------------------------------------------------------------------------------------------------------
Expand Down
12 changes: 8 additions & 4 deletions modules/vpc-network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ variable "secondary_cidr_subnetwork_spacing" {
default = 0
}

variable "enable_flow_logging" {
description = "Whether to enable VPC Flow Logs being sent to Stackdriver (https://cloud.google.com/vpc/docs/using-flow-logs)"
type = bool
default = true
variable "log_config" {
description = "The logging options for the subnetwork flow logs."
type = object({
aggregation_interval = string
flow_sampling = number
metadata = string
})
default = null
}

variable allowed_public_restricted_subnetworks {
Expand Down

0 comments on commit b58bfd4

Please sign in to comment.