Skip to content

data-platform-hq/terraform-azurerm-nat-gateway

Repository files navigation

Azure Nat Gateway Terraform module

Terraform module for creation Azure Nat Gateway

Usage

This module is provisioning Public IP Address, Azure NAT Gateway which is associated with target subnets.

data "azurerm_subnet" "one" {
  name                 = "example_one"
  resource_group_name  = "example_rg"
  virtual_network_name = "example_vnet"
}

data "azurerm_subnet" "two" {
  name                 = "example_two"
  resource_group_name  = "example_rg"
  virtual_network_name = "example_vnet"
}

module "nat" {
  source  = "data-platform-hq/nat-gateway/azurerm"
  version = "~> 1.0"

  nat_gateway_name = "datahq-nat"
  location         = "eastus"
  tags             = { environment = "example" }
  resource_group   = "example_rg"

  subnets = {
    (data.azurerm_subnet.one.name) = data.azurerm_subnet.one.id,
    (data.azurerm_subnet.two.name) = data.azurerm_subnet.two.id
  }
}

Requirements

Name Version
terraform >= 1.0.0
azurerm >= 4.0.1

Providers

Name Version
azurerm >= 4.0.1

Modules

No modules.

Resources

Name Type
azurerm_nat_gateway.this resource
azurerm_nat_gateway_public_ip_association.this resource
azurerm_public_ip.this resource
azurerm_subnet_nat_gateway_association.this resource

Inputs

Name Description Type Default Required
location Azure location string n/a yes
nat_gateway_configuration Configuration options for azure nat gateway
object({
sku = optional(string, "Standard")
idle_time = optional(number, 10)
zones = optional(list(string), [])
})
{} no
nat_gateway_name NAT Gateway name string n/a yes
nat_gateway_public_ip_name NAT Gateway public ip resource name string null no
public_ip_configuration Configuration options for public ip
object({
allocation_method = optional(string, "Static")
sku = optional(string, "Standard")
zones = optional(list(string), [])
})
{} no
resource_group Resource group string n/a yes
subnets Name to id map of subnet associated with NAT Gateway map(string) {} no
tags Resource tags map(any) {} no

Outputs

Name Description
id Nat gateway id
name Nat gateway name
public_ip_address Public ip address