Skip to content

pmula-onbe/terraform-azurerm-route-table

 
 

Repository files navigation

Azure Route Table

Changelog Notice Apache V2 License TF Registry

This feature creates an Azure Route Table with an option to create a Force Tunneling route. You need to associate this Route Table with any subnet that needs those special routing features.

Global versioning rule for Claranet Azure modules

Module version Terraform version AzureRM version
>= 5.x.x 0.15.x & 1.0.x >= 2.0
>= 4.x.x 0.13.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

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.

module "azure_region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location    = module.azure_region.location
  client_name = var.client_name
  environment = var.environment
  stack       = var.stack
}

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.resource_group_name
  vnet_cidr           = ["10.10.1.0/16"]
}

module "azure_network_route_table" {
  source  = "claranet/route-table/azurerm"
  version = "x.x.x"

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

  # You can set either a prefix for generated name or a custom one for the resource naming
  #custom_name = "my_route_table"

  # Options
  disable_bgp_route_propagation = false

  enable_force_tunneling = true

  extra_tags = {
    foo = "bar"
  }
}

resource "azurerm_route" "custom_route" {
  name                = "acceptanceTestRoute1"
  resource_group_name = module.rg.resource_group_name
  route_table_name    = module.azure_network_route_table.route_table_name
  address_prefix      = "10.1.0.0/16"
  next_hop_type       = "VnetLocal"
}

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.resource_group_name

  virtual_network_name = module.azure_network_vnet.virtual_network_name
  subnet_cidr_list     = ["10.10.1.0/24"]

  route_table_name = module.azure_network_route_table.route_table_name
}

Providers

Name Version
azurecaf ~> 1.1
azurerm >= 1.36

Modules

No modules.

Resources

Name Type
azurecaf_name.rt resource
azurerm_route.force_internet_tunneling resource
azurerm_route_table.route_table resource

Inputs

Name Description Type Default Required
client_name Client name/account used in naming string n/a yes
custom_name Custom Route table name, generated if not set string "" no
default_tags_enabled Option to enable or disable default tags bool true no
disable_bgp_route_propagation Option to disable BGP route propagation on this Route Table. bool false no
enable_force_tunneling Option to enable a route to Force Tunneling (force 0.0.0.0/0 traffic through the Gateway next hop). bool false no
environment Project environment string n/a yes
extra_tags Additional tags to associate with your resources. map(string) {} no
location Azure location. string n/a yes
location_short Short string for Azure location. string n/a yes
name_prefix Optional prefix for the generated name string "" no
name_suffix Optional suffix for the generated name string "" no
resource_group_name Resource group name string n/a yes
stack Project stack name string n/a yes
use_caf_naming Use the Azure CAF naming provider to generate default resource name. custom_name override this if set. Legacy default name is used if this is set to false. bool true no

Outputs

Name Description
route_force_tunneling Force tunneling route status
route_table_id Route table ID
route_table_name Route table name

Related documentation

About

Terraform module for Azure route table

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 100.0%