Add support for logging in net-cloudnat (#115)

* add logging support to net-cloudnat

* use default for logging filter
This commit is contained in:
Ludovico Magnocavallo 2020-07-23 09:29:24 +02:00 committed by GitHub
parent 5bd6fb4315
commit fc99ade009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,7 @@ module "nat" {
| *config_min_ports_per_vm* | Minimum number of ports allocated to a VM from this NAT config. | <code title="">number</code> | | <code title="">64</code> |
| *config_source_subnets* | Subnetwork configuration (ALL_SUBNETWORKS_ALL_IP_RANGES, ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, LIST_OF_SUBNETWORKS). | <code title="">string</code> | | <code title="">ALL_SUBNETWORKS_ALL_IP_RANGES</code> |
| *config_timeouts* | Timeout configurations. | <code title="object&#40;&#123;&#10;icmp &#61; number&#10;tcp_established &#61; number&#10;tcp_transitory &#61; number&#10;udp &#61; number&#10;&#125;&#41;">object({...})</code> | | <code title="&#123;&#10;icmp &#61; 30&#10;tcp_established &#61; 1200&#10;tcp_transitory &#61; 30&#10;udp &#61; 30&#10;&#125;">...</code> |
| *logging_filter* | Enables logging if not null, value is one of 'ERRORS_ONLY', 'TRANSLATIONS_ONLY', 'ALL'. | <code title="">string</code> | | <code title="">null</code> |
| *router_asn* | Router ASN used for auto-created router. | <code title="">number</code> | | <code title="">64514</code> |
| *router_create* | Create router. | <code title="">bool</code> | | <code title="">true</code> |
| *router_name* | Router name, leave blank if router will be created to use auto generated name. | <code title="">string</code> | | <code title="">null</code> |

View File

@ -47,6 +47,11 @@ resource "google_compute_router_nat" "nat" {
tcp_established_idle_timeout_sec = var.config_timeouts.tcp_established
tcp_transitory_idle_timeout_sec = var.config_timeouts.tcp_transitory
log_config {
enable = var.logging_filter == null ? false : true
filter = var.logging_filter == null ? "ALL" : var.logging_filter
}
dynamic "subnetwork" {
for_each = var.subnetworks
content {

View File

@ -48,6 +48,12 @@ variable "config_timeouts" {
}
}
variable "logging_filter" {
description = "Enables logging if not null, value is one of 'ERRORS_ONLY', 'TRANSLATIONS_ONLY', 'ALL'."
type = string
default = null
}
variable "name" {
description = "Name of the Cloud NAT resource."
type = string