Terraform module to create an Azure VNet
module "network" {
source = "../"
resource_group_name = "your-rg"
resource_group_location = "westeuropoe"
vnet_name = "your-vnet"
address_spaces = ["10.2.0.0/16"]
subnet_prefixes = ["10.2.0.0/19", "10.2.32.0/19", "10.2.64.0/19", "10.2.96.0/19"]
subnet_names = ["cluster", "database", "services", "public"]
use_for_each = false
subnet_service_endpoints = {
"cluster" : ["Microsoft.EventHub", "Microsoft.Storage", "Microsoft.ServiceBus"]
}
subnet_delegation = {
"database" : [{
name = "mysql-fs"
service_delegation = {
name = "Microsoft.DBforMySQL/flexibleServers"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
}
}
]
}
}
Name | Version |
---|---|
terraform | >= 1.2 |
azurerm | ~> 3 |
Name | Version |
---|---|
azurerm | ~> 3 |
Name | Type |
---|---|
azurerm_subnet.subnet_count | resource |
azurerm_subnet.subnet_for_each | resource |
azurerm_virtual_network.vnet | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
address_space | The address space that is used by the virtual network. | string |
"10.0.0.0/16" |
no |
address_spaces | The list of the address spaces that is used by the virtual network. | list(string) |
[] |
no |
dns_servers | The DNS servers to be used with vNet. | list(string) |
[] |
no |
resource_group_location | The location/region where the virtual network is created. Changing this forces a new resource to be created. | string |
null |
no |
resource_group_name | The name of an existing resource group to be imported. | string |
n/a | yes |
subnet_delegation | service_delegation blocks for azurerm_subnet resource, subnet names as keys, list of delegation blocks as value, more details about delegation block could be found at the document. |
map(list(object({ |
{} |
no |
subnet_names | A list of public subnets inside the vNet. | list(string) |
[ |
no |
subnet_prefixes | The address prefix to use for the subnet. | list(string) |
[ |
no |
subnet_service_endpoints | A map with key (string) subnet name , value (list(string)) to indicate enabled service endpoints on the subnet. Default value is []. |
map(list(string)) |
{} |
no |
tags | The tags to associate with your network and subnets. | map(string) |
{ |
no |
tracing_tags_enabled | Whether enable tracing tags that generated by BridgeCrew Yor. | bool |
false |
no |
tracing_tags_prefix | Default prefix for generated tracing tags | string |
"avm_" |
no |
use_for_each | Use for_each instead of count to create multiple resource instances. |
bool |
n/a | yes |
vnet_name | Name of the vnet to create. | string |
"acctvnet" |
no |
Name | Description |
---|---|
vnet_address_space | The address space of the newly created vNet |
vnet_id | The id of the newly created vNet |
vnet_location | The location of the newly created vNet |
vnet_name | The name of the newly created vNet |
vnet_subnets | The subnets created inside the newly created vNet |
vnet_subnets_ids | The ids of subnets created inside the newly created vNet |
We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.
Checkout our other 👉 terraform modules
Copyright © 2017-2024 Blackbird Cloud