This module allows managing resources related to Azure networks:
- Virtual Networks
- Subnets
- Network security groups
- Network security group rules
You can set up the variables in terraform.tfvars
file
location = "westeurope"
resource_group_name = ""
tags = {}
virtual_network = {
name = ""
address_space = [""]
subnets = {
"" = {
address_prefixes = [""]
network_security_group = {
name = ""
rules = [
{
name = ""
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "80"
source_address_prefix = "*"
destination_address_prefix = "*"
}
]
}
}
}
}
You can configure multiple NSG rules for one or multiple
module "naming" {
source = "Azure/naming/azurerm"
version = "0.4.1"
suffix = ["multiple-security-rules"]
}
#tflint-ignore: all
module "network" {
source = "../../"
resource_group_name = module.naming.resource_group.name
virtual_network = {
name = module.naming.virtual_network.name
address_space = ["10.0.0.0/16"]
subnets = {
"my-subnet-1" = {
address_prefixes = ["10.0.1.0/24"]
network_security_group = {
name = "nsg1"
rules = [
{
name = "rule1"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "80"
source_address_prefix = "*"
destination_address_prefix = "*"
},
{
name = "rule2"
priority = 200
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "*"
destination_address_prefix = "*"
}
]
}
}
}
}
tags = {}
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
location | The location/region where the virtual network is created. | string |
"westeurope" |
no |
resource_group_name | The name of the resource group in which to create the virtual network. | string |
n/a | yes |
tags | A mapping of tags to assign to the resource. | map(string) |
{} |
no |
virtual_network | Represents a virtual network. | object({ |
n/a | yes |
Name | Description |
---|---|
vnet_id | The virtual network ID. |
vnet_name | The name of the virtual network. |