Skip to content

Latest commit

 

History

History
144 lines (112 loc) · 7.03 KB

README.md

File metadata and controls

144 lines (112 loc) · 7.03 KB

Azure NAT Gateway

Changelog Notice Apache V2 License OpenTofu Registry

Common Azure terraform module to create a nat gateway and do the association with subnet(s).

Global versioning rule for Claranet Azure modules

Module version Terraform version OpenTofu version AzureRM version
>= 8.x.x Unverified 1.8.x >= 4.0
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with Hashicorp Terraform. Instead, we recommend to use OpenTofu.

module "azure_network_vnet" {
  source  = "claranet/vnet/azurerm"
  version = "x.x.x"

  environment         = var.environment
  location            = module.azure_region.location
  location_short      = module.azure_region.location_short
  client_name         = var.client_name
  stack               = var.stack
  resource_group_name = module.rg.name

  cidrs = ["10.0.1.0/24"]
}

module "azure_network_subnet" {
  source  = "claranet/subnet/azurerm"
  version = "x.x.x"

  environment         = var.environment
  location_short      = module.azure_region.location_short
  client_name         = var.client_name
  stack               = var.stack
  resource_group_name = module.rg.name

  virtual_network_name = module.azure_network_vnet.name
  cidrs                = ["10.0.1.0/26"]
}

module "nat_gateway" {
  source  = "claranet/nat-gateway/azurerm"
  version = "x.x.x"

  client_name         = var.client_name
  environment         = var.environment
  location            = module.azure_region.location
  location_short      = module.azure_region.location_short
  stack               = var.stack
  resource_group_name = module.rg.name

  subnet_ids = [module.azure_network_subnet.id]
}

Providers

Name Version
azurecaf ~> 1.2.28
azurerm ~> 4.0

Modules

No modules.

Resources

Name Type
azurerm_nat_gateway.main resource
azurerm_nat_gateway_public_ip_association.custom_ips resource
azurerm_nat_gateway_public_ip_association.main resource
azurerm_public_ip.main resource
azurerm_subnet_nat_gateway_association.main resource
azurecaf_name.nat data source
azurecaf_name.pip_nat data source

Inputs

Name Description Type Default Required
client_name Client name/account used in naming. string n/a yes
custom_name Custom name for Nat Gateway. string null no
default_tags_enabled Option to enable or disable default tag. bool true no
environment Project environment. string n/a yes
extra_tags Extra tags to add. map(string) {} no
idle_timeout Idle timeout configuration in minutes for Nat Gateway. number 4 no
location Azure region to use. string n/a yes
location_short Short name of Azure region to use. string n/a yes
name_prefix Optional prefix for the generated name. string "" no
name_suffix Optional suffix for the generated name. string "" no
public_ip_created Whether to create a public IP or not. bool true no
public_ip_custom_name Custom name for public IP. string null no
public_ip_domain_name_label DNS domain label for Nat Gateway public IP. string null no
public_ip_ids List of public IPs to use. Create one IP if not provided. list(string) [] no
public_ip_reverse_fqdn Reverse FQDN for Nat Gateway public IP. string null no
public_ip_zones Public IP zones to configure. list(string) null no
resource_group_name Name of the resource group to use. string n/a yes
stack Project stack name. string n/a yes
subnet_ids IDs of subnets to associate with the Nat Gateway. list(string) n/a yes

Outputs

Name Description
id Nat Gateway ID.
name Nat Gateway name.
public_ip_ids IDs of public IPs.
public_ips_adresses Public IPs addresses associated to Nat Gateway.
resource Nat Gateway resource object.
resource_public_ips Public IPs resources list object.

Related documentation

Azure NAT Gateway documentation: docs.microsoft.com/en-us/azure/virtual-network/nat-gateway-resource

Azure public IP documentation: docs.microsoft.com/en-us/azure/virtual-network/public-ip-addresses