github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/azurerm/r/network_security_rule.html.markdown (about)

     1  ---
     2  layout: "azurerm"
     3  page_title: "Azure Resource Manager: azurerm_network_security_rule"
     4  sidebar_current: "docs-azurerm-resource-network-security-rule"
     5  description: |-
     6    Create a Network Security Rule.
     7  ---
     8  
     9  # azurerm\_network\_security\_rule
    10  
    11  Create a Network Security Rule.
    12  
    13  ## Example Usage
    14  
    15  ```hcl
    16  resource "azurerm_resource_group" "test" {
    17    name     = "acceptanceTestResourceGroup1"
    18    location = "West US"
    19  }
    20  
    21  resource "azurerm_network_security_group" "test" {
    22    name                = "acceptanceTestSecurityGroup1"
    23    location            = "West US"
    24    resource_group_name = "${azurerm_resource_group.test.name}"
    25  }
    26  
    27  resource "azurerm_network_security_rule" "test" {
    28    name                        = "test123"
    29    priority                    = 100
    30    direction                   = "Outbound"
    31    access                      = "Allow"
    32    protocol                    = "Tcp"
    33    source_port_range           = "*"
    34    destination_port_range      = "*"
    35    source_address_prefix       = "*"
    36    destination_address_prefix  = "*"
    37    resource_group_name         = "${azurerm_resource_group.test.name}"
    38    network_security_group_name = "${azurerm_network_security_group.test.name}"
    39  }
    40  ```
    41  
    42  ## Argument Reference
    43  
    44  The following arguments are supported:
    45  
    46  * `name` - (Required) The name of the security rule.
    47  
    48  * `resource_group_name` - (Required) The name of the resource group in which to
    49      create the Network Security Rule.
    50  
    51  * `network_security_group_name` - (Required) The name of the Network Security Group that we want to attach the rule to.
    52  
    53  * `description` - (Optional) A description for this rule. Restricted to 140 characters.
    54  
    55  * `protocol` - (Required) Network protocol this rule applies to. Can be Tcp, Udp or * to match both.
    56  
    57  * `source_port_range` - (Required) Source Port or Range. Integer or range between 0 and 65535 or * to match any.
    58  
    59  * `destination_port_range` - (Required) Destination Port or Range. Integer or range between 0 and 65535 or * to match any.
    60  
    61  * `source_address_prefix` - (Required) CIDR or source IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used.
    62  
    63  * `destination_address_prefix` - (Required) CIDR or destination IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used.
    64  
    65  * `access` - (Required) Specifies whether network traffic is allowed or denied. Possible values are "Allow” and "Deny”.
    66  
    67  * `priority` - (Required) Specifies the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.
    68  
    69  * `direction` - (Required) The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are "Inbound” and "Outbound”.
    70  
    71  ## Attributes Reference
    72  
    73  The following attributes are exported:
    74  
    75  * `id` - The Network Security Rule ID.
    76  
    77  
    78  ## Import
    79  
    80  Network Security Rules can be imported using the `resource id`, e.g.
    81  
    82  ```
    83  terraform import azurerm_network_security_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup/securityRules/rule1
    84  ```