FEATURES PRICING ABOUT DOCS LOGIN

azurerm_security_group

Create a network security group that contains a list of network security rules.

Example Usage

resource "azurerm_resource_group" "test" {
    name = "acceptanceTestResourceGroup1"
    location = "West US"
}

resource "azurerm_network_security_group" "test" {
    name = "acceptanceTestSecurityGroup1"
    location = "West US"
    resource_group_name = "${azurerm_resource_group.test.name}"

    security_rule {
    	name = "test123"
    	priority = 100
    	direction = "Inbound"
    	access = "Allow"
    	protocol = "Tcp"
    	source_port_range = "*"
    	destination_port_range = "*"
    	source_address_prefix = "*"
    	destination_address_prefix = "*"
    }
    
    tags {
        environment = "Production"
    }
}

Argument Reference

The following arguments are supported:

The security_rule block supports:

Attributes Reference

The following attributes are exported:

Import

Network Security Groups can be imported using the resource id, e.g.

terraform import azurerm_network_security_group.group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup

See the source of this document at Terraform.io

REQUEST A DEMO