nat-instance

garbetjie/nat-instance/google

Terraform Module HCL GOOGLE

Terraform module for creating NAT instances in GCP.

Install
module "nat-instance" {
source = "garbetjie/nat-instance/google"
version = "3.0.1"
}
plain text: /constructs/tfmod-garbetjie-nat-instance-google/install.txt
⭐ Source on GitHub 📦 Registry page
README

Terraform Module: NAT instances (Google provider) ================================================= A simple Terraform module for Google Cloud Platform that creates a NAT instance to forward traffic from internal instances without external IP addresses to the internet. Why? By default, Google Compute instances without an external IP address are unable to access the internet. Google also provides Cloud NAT which provides the same functionality as is implemented in this module. However, as per https://cloud.google.com/nat/docs/ports-and-addresses#ports-reuse-tcp, Google Cloud enforces a two-minute delay before the gateway can reuse the same NAT source IP address and source port tuple with the same destination (destination IP address, destination port, and protocol). This poses a problem when

Inputs (10)
NameTypeDescriptionDefault
addressstringExternal IP address to assign to this instance. required
zonestringZone in which to place this instance. Must be the same region as the IP address required
network_tagsset(string)Tags to which this route applies. Defaults to ["requires-nat-${local.region}"][]
wait_durationnumberThe duration (in seconds) to wait for the NAT instance to finish starting up.10
disk_sizenumberSize of the instance's disk (in GB).15
disk_typestringType of the instance's disk (one of `pd-standard` or `pd-ssd`). `google` provide"pd-standard"
machine_typestringMachine type of the instance."f1-micro"
socks_proxyobject({ enabled = bool Configuration for managing a SOCKS proxy on this instance.{ "allowed_ranges": [], "debug": 0,
sysctl_configmap(string)sysctl configuration to apply on startup.{}
route_prioritynumberThe priority to assign the networking route that routes traffic through this ins900
Outputs (13)
address — Internal IP address of this NAT instance.
nat_address — NAT IP address of this NAT instance.
disk_size — Size of the instance's disk (in GB).
network_tags — Tags to which this instance's route applies.
instance_name — Name of the Compute Engine instance.
route_name — Name of the route used to route traffic through the instance.
route_priority — Priority assigned to the networking route used to route traffic through this instance.
zone — Zone in which the Compute Engine instance has been placed.
machine_type — Machine type of the instance.
disk_type — Type of the instance's disk.
wait_duration — The duration (in seconds) that was allowed for the NAT instance to finish booting.
sysctl_config — sysctl config applied on NAT instance boot.
socks_proxy — SOCKS proxy config applied.
Resources (6)
google_compute_addressgoogle_compute_firewallgoogle_compute_instancegoogle_compute_routenull_resourcerandom_id
Details
FrameworkTerraform Module
LanguageHCL
Version3.0.1
Cloud GOOGLE
★ Stars7
Forks2
Total downloads5.3k
Inputs10
Outputs13
Resources6
LicenseMIT
Namespacegarbetjie
Updated