| Module version | Terraform version | AzureRM version |
|---|---|---|
| >= 5.x.x | >= 1.9.x | >= 4.27.0 |
| >= 4.x.x | >= 1.3.x | >= 3.58.0 |
| >= 3.x.x | >= 1.3.x | >= 3.28.0 |
| >= 2.x.x | >= 0.13.x | >= 2.36.0 |
| >= 1.x.x | >= 0.13.x | >= 2.8.0 |
resource "azurerm_resource_group" "rg" {
name = "resource-group"
location = "Spain Central"
}
module "virtual_network" {
source = "aztfm/virtual-network/azurerm"
version = ">=5.0.0"
name = "virtual-network"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
address_space = ["10.0.0.0/16"]
subnets = [{
name = "subnet"
address_prefixes = ["10.0.0.0/24"]
}]
}Reference to more examples.
The following parameters are supported:
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| name | The name of the virtual network. | string |
n/a | yes |
| resource_group_name | The name of the resource group in which to create the virtual network. | string |
n/a | yes |
| location | The location/region where the virtual network is created. | string |
n/a | yes |
| tags | A mapping of tags to assign to the resource. | map(string) |
{} |
no |
| address_space | The address space that is used in the virtual network. More than one address space can be provisioned. | list(string) |
n/a | yes |
| dns_servers | List of IP addresses of DNS servers. | list(string) |
[] |
no |
| ddos_protection_plan_id | The ID of DDoS Protection Plan. | string |
null |
no |
| bgp_community | The BGP community attribute in format <as-number>:<community-value>. The as-number segment is the Microsoft ASN, which is always 12076 for now. |
string |
null |
no |
| encryption_mode | The encryption mode for the virtual network. Possible values are 'AllowUnencrypted' or 'DropUnencrypted'. | string |
null |
no |
| subnets | List of objects that represent the configuration of each subnet. | list(object({})) |
[] |
no |
The subnets supports the following:
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| name | The name of the subnet. | string |
n/a | yes |
| address_prefixes | The address prefix/es to use for the subnet. | list(string) |
n/a | yes |
| default_outbound_access_enabled | Enable default outbound access to the internet for the subnet. | bool |
false |
no |
| service_endpoints | The list of Service endpoints to associate with the subnet. Possible values include: Microsoft.AzureActiveDirectory, Microsoft.AzureCosmosDB, Microsoft.ContainerRegistry, Microsoft.EventHub, Microsoft.KeyVault, Microsoft.ServiceBus, Microsoft.Sql, Microsoft.Storage, Microsoft.Storage.Global and Microsoft.Web. |
string |
null |
no |
| delegation | The name of service to delegate to. Possible values include: GitHub.Network/networkSettings, Informatica.DataManagement/organizations, Microsoft.ApiManagement/service, Microsoft.Apollo/npu, Microsoft.App/environments, Microsoft.App/testClients, Microsoft.AVS/PrivateClouds, Microsoft.AzureCosmosDB/clusters, Microsoft.BareMetal/AzureHostedService, Microsoft.BareMetal/AzureVMware, Microsoft.BareMetal/CrayServers, Microsoft.Batch/batchAccounts, Microsoft.CloudTest/hostedpools, Microsoft.CloudTest/images, Microsoft.CloudTest/pools, Microsoft.Codespaces/plans, Microsoft.ContainerInstance/containerGroups, Microsoft.ContainerService/managedClusters, Microsoft.Databricks/workspaces, Microsoft.DBforMySQL/flexibleServers, Microsoft.DBforMySQL/servers, Microsoft.DBforMySQL/serversv2, Microsoft.DBforPostgreSQL/flexibleServers, Microsoft.DBforPostgreSQL/serversv2, Microsoft.DBforPostgreSQL/singleServers, Microsoft.DelegatedNetwork/controller, Microsoft.DevCenter/networkConnection, Microsoft.DevOpsInfrastructure/pools, Microsoft.DocumentDB/cassandraClusters, Microsoft.Fidalgo/networkSettings, Microsoft.HardwareSecurityModules/dedicatedHSMs, Microsoft.Kusto/clusters, Microsoft.LabServices/labplans, Microsoft.Logic/integrationServiceEnvironments, Microsoft.MachineLearningServices/workspaces, Microsoft.Netapp/volumes, Microsoft.Network/applicationGateways, Microsoft.Network/dnsResolvers, Microsoft.Network/networkWatchers, Microsoft.Orbital/orbitalGateways, Microsoft.PowerAutomate/hostedRpa, Microsoft.PowerPlatform/enterprisePolicies, Microsoft.PowerPlatform/vnetaccesslinks, Microsoft.ServiceFabricMesh/networks, Microsoft.ServiceNetworking/trafficControllers, Microsoft.Singularity/accounts/networks, Microsoft.Singularity/accounts/npu, Microsoft.Sql/managedInstances, Microsoft.StoragePool/diskPools, Microsoft.StreamAnalytics/streamingJobs, Microsoft.Synapse/workspaces, Microsoft.Web/hostingEnvironments, Microsoft.Web/serverFarms, NGINX.NGINXPLUS/nginxDeployments, PaloAltoNetworks.Cloudngfw/firewalls, Qumulo.Storage/fileSystems and Oracle.Database/networkAttachments. |
string |
null |
no |
| private_endpoint_network_policies | Enable or Disable network policies for the private endpoint on the subnet. Possible values include: Disabled, Enabled, NetworkSecurityGroupEnabled and RouteTableEnabled. |
string |
Disabled |
no |
| private_link_service_network_policies_enabled | Enable or Disable network policies for the private link service on the subnet. | bool |
false |
no |
The following outputs are exported:
| Name | Description | Sensitive |
|---|---|---|
| id | The virtual network configuration ID. | no |
| guid | The GUID of the virtual network. | no |
| name | The name of the virtual network. | no |
| resource_group_name | The name of the resource group in which to create the virtual network. | no |
| location | The location/region where the virtual network is created. | no |
| tags | The tags assigned to the resource. | no |
| address_space | The list of address spaces used by the virtual network. | no |
| dns_servers | The list of DNS servers used by the virtual network. | no |
| ddos_protection_plan | Block containing configuration of ddos protection plan. | no |
| subnets | Blocks containing configuration of each subnet. | no |