diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
index aa77632..d59ead9 100644
--- a/.github/workflows/preview.yml
+++ b/.github/workflows/preview.yml
@@ -14,8 +14,8 @@ jobs:
steps:
- name: Checkout
# for security reasons we pin commit ids and not tags.
- # actions/checkout@v3.0.2 -> 2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
+ # actions/checkout@v4.1.4 -> 0ad4b8fadaa221de15dcec353f45205ec38ea70b
+ uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
with:
fetch-depth: 0
@@ -65,8 +65,8 @@ jobs:
steps:
- name: Checkout
# for security reasons we pin commit ids and not tags.
- # actions/checkout@v3.0.2 -> 2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
+ # actions/checkout@v4.1.4 -> 0ad4b8fadaa221de15dcec353f45205ec38ea70b
+ uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
with:
fetch-depth: 0
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0373d91..82bfa53 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -16,8 +16,8 @@ jobs:
steps:
- name: Checkout
# for security reasons we pin commit ids and not tags.
- # actions/checkout@v3.0.2 -> 2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
+ # actions/checkout@v4.1.4 -> 0ad4b8fadaa221de15dcec353f45205ec38ea70b
+ uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
with:
fetch-depth: 0
@@ -69,8 +69,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- # actions/checkout@v3.0.2
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
+ # actions/checkout@v4.1.4
+ uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
with:
fetch-depth: 0
diff --git a/README.md b/README.md
index 2c7155f..418cf8d 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
A [Terraform] module for [Google Cloud Platform (GCP)][gcp].
**_This module supports Terraform version 1
-and is compatible with the Terraform Google Provider version 4._** and 5._**
+and is compatible with the Terraform Google Provider version 4._** (4.28 and later) and 5._**
This module is part of our Infrastructure as Code (IaC) framework
that enables our users and customers to easily deploy and manage reusable,
@@ -207,10 +207,23 @@ See [variables.tf] and [examples/] for details and use-cases.
Self-links of NAT IPs. Only valid if `natIpAllocateOption` is set to MANUAL_ONLY.
+ - [**`enable_dynamic_port_allocation`**](#attr-nats-enable_dynamic_port_allocation): *(Optional `bool`)*
+
+ Enable Dynamic Port Allocation.
+ If minPortsPerVm is set, minPortsPerVm must be set to a power of two greater than or equal to 32.
+ If minPortsPerVm is not set, a minimum of 32 ports will be allocated to a VM from this NAT config.
+ If maxPortsPerVm is set, maxPortsPerVm must be set to a power of two greater than minPortsPerVm.
+ If maxPortsPerVm is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config.
+ Mutually exclusive with enableEndpointIndependentMapping.
+
- [**`min_ports_per_vm`**](#attr-nats-min_ports_per_vm): *(Optional `number`)*
Minimum number of ports allocated to a VM from this NAT.
+ - [**`min_ports_per_vm`**](#attr-nats-min_ports_per_vm): *(Optional `number`)*
+
+ Maximum number of ports allocated to a VM from this NAT.
+
- [**`udp_idle_timeout_sec`**](#attr-nats-udp_idle_timeout_sec): *(Optional `number`)*
Timeout (in seconds) for UDP connections.
diff --git a/README.tfdoc.hcl b/README.tfdoc.hcl
index e6b2acb..6b843b6 100644
--- a/README.tfdoc.hcl
+++ b/README.tfdoc.hcl
@@ -40,7 +40,7 @@ section {
A [Terraform] module for [Google Cloud Platform (GCP)][gcp].
**_This module supports Terraform version 1
- and is compatible with the Terraform Google Provider version 4._** and 5._**
+ and is compatible with the Terraform Google Provider version 4._** (4.28 and later) and 5._**
This module is part of our Infrastructure as Code (IaC) framework
that enables our users and customers to easily deploy and manage reusable,
@@ -269,6 +269,18 @@ section {
END
}
+ attribute "enable_dynamic_port_allocation" {
+ type = bool
+ description = <<-END
+ Enable Dynamic Port Allocation.
+ If minPortsPerVm is set, minPortsPerVm must be set to a power of two greater than or equal to 32.
+ If minPortsPerVm is not set, a minimum of 32 ports will be allocated to a VM from this NAT config.
+ If maxPortsPerVm is set, maxPortsPerVm must be set to a power of two greater than minPortsPerVm.
+ If maxPortsPerVm is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config.
+ Mutually exclusive with enableEndpointIndependentMapping.
+ END
+ }
+
attribute "min_ports_per_vm" {
type = number
description = <<-END
@@ -276,6 +288,13 @@ section {
END
}
+ attribute "min_ports_per_vm" {
+ type = number
+ description = <<-END
+ Maximum number of ports allocated to a VM from this NAT.
+ END
+ }
+
attribute "udp_idle_timeout_sec" {
type = number
default = 30
diff --git a/nat.tf b/nat.tf
index d1086e0..75a7b88 100644
--- a/nat.tf
+++ b/nat.tf
@@ -15,7 +15,9 @@ resource "google_compute_router_nat" "nat" {
nat_ips = try(each.value.nat_ips, null)
- min_ports_per_vm = try(each.value.min_ports_per_vm, null)
+ enable_dynamic_port_allocation = try(each.value.enable_dynamic_port_allocation, null)
+ min_ports_per_vm = try(each.value.min_ports_per_vm, null)
+ max_ports_per_vm = try(each.value.max_ports_per_vm, null)
udp_idle_timeout_sec = try(each.value.idle_timeout_sec, 30)
icmp_idle_timeout_sec = try(each.value.icmp_idle_timeout_sec, 30)
diff --git a/versions.tf b/versions.tf
index c37cb64..6fee474 100644
--- a/versions.tf
+++ b/versions.tf
@@ -8,7 +8,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
- version = ">= 3.50, < 6"
+ version = ">= 4.28, < 6"
}
}
}