Skip to content

sironite/terraform-azurerm-subnet

Repository files navigation

Azure subnet

Changelog Notice Apache V2 License TF Registry

Usage - Module

one subnet

module "subnet" {
  source  = "sironite/subnet/azurerm"
  version = "x.x.x"

  azure_location       = var.azure_location
  resource_group_name  = var.resource_group_name
  virtual_network_name = var.virtual_network_name
  subnet_name          = var.subnet_name
  address_prefixes     = var.address_prefixes

}

multiple subnet

module "subnet" {
  source  = "sironite/subnet/azurerm"
  version = "x.x.x"

  for_each = var.subnet_config

  azure_location       = var.azure_location
  resource_group_name  = var.resource_group_name
  virtual_network_name = var.virtual_network_name
  subnet_name          = each.value.subnet_name
  address_prefixes     = each.value.address_prefixes

}

Providers

Name Version
azurerm >= 2.0.0

Modules

No modules.

Resources

Name Type
azurerm_subnet.this resource

Inputs

Name Description Type Required
address_prefixes The address prefixes to use for the subnet. list(string) yes
azure_location The location/region where the virtual network is created. Changing this forces a new resource to be created. string yes
resource_group_name The name of the resource group in which to create the subnet. Changing this forces a new resource to be created. string yes
subnet_delegation The delegation configuration for the subnet.
map(set(object({
name = string
actions = set(string)
})))
yes
subnet_name The name of the subnet. Changing this forces a new resource to be created. string yes
virtual_network_name The name of the virtual network to which to attach the subnet. Changing this forces a new resource to be created. string yes
private_endpoint_network_policies_enabled Enable or Disable network policies for the private endpoint on the subnet. Setting this to true will Enable the policy and setting this to false will Disable the policy. Defaults to true. bool no
private_link_service_network_policies_enabled Enable or Disable network policies for the private link service on the subnet. Setting this to true will Enable the policy and setting this to false will Disable the policy. Defaults to true. bool no
service_endpoint_policy_ids The list of IDs of Service Endpoint Policies to associate with the subnet. list(string) no
service_endpoints The list of Service endpoints to associate with the subnet. list(string) no

Outputs

Name Description
azurerm_subnet_address_prefixes The address prefixes for the subnet
azurerm_subnet_id The subnet ID.
azurerm_subnet_name The name of the subnet.
azurerm_subnet_resource_group_name The name of the resource group in which the subnet is created in.
azurerm_subnet_virtual_network_name The name of the virtual network in which the subnet is created in

Related documentation