github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/azurerm/r/loadbalancer_nat_rule.html.markdown (about) 1 --- 2 layout: "azurerm" 3 page_title: "Azure Resource Manager: azurerm_lb_nat_rule" 4 sidebar_current: "docs-azurerm-resource-loadbalancer-nat-rule" 5 description: |- 6 Create a LoadBalancer NAT Rule. 7 --- 8 9 # azurerm\_lb\_nat\_rule 10 11 Create a LoadBalancer NAT Rule. 12 13 ~> **NOTE When using this resource, the LoadBalancer needs to have a FrontEnd IP Configuration Attached 14 15 ## Example Usage 16 17 ```hcl 18 resource "azurerm_resource_group" "test" { 19 name = "LoadBalancerRG" 20 location = "West US" 21 } 22 23 resource "azurerm_public_ip" "test" { 24 name = "PublicIPForLB" 25 location = "West US" 26 resource_group_name = "${azurerm_resource_group.test.name}" 27 public_ip_address_allocation = "static" 28 } 29 30 resource "azurerm_lb" "test" { 31 name = "TestLoadBalancer" 32 location = "West US" 33 resource_group_name = "${azurerm_resource_group.test.name}" 34 35 frontend_ip_configuration { 36 name = "PublicIPAddress" 37 public_ip_address_id = "${azurerm_public_ip.test.id}" 38 } 39 } 40 41 resource "azurerm_lb_nat_rule" "test" { 42 resource_group_name = "${azurerm_resource_group.test.name}" 43 loadbalancer_id = "${azurerm_lb.test.id}" 44 name = "RDP Access" 45 protocol = "Tcp" 46 frontend_port = 3389 47 backend_port = 3389 48 frontend_ip_configuration_name = "PublicIPAddress" 49 } 50 ``` 51 52 ## Argument Reference 53 54 The following arguments are supported: 55 56 * `name` - (Required) Specifies the name of the NAT Rule. 57 * `resource_group_name` - (Required) The name of the resource group in which to create the resource. 58 * `loadbalancer_id` - (Required) The ID of the LoadBalancer in which to create the NAT Rule. 59 * `frontend_ip_configuration_name` - (Required) The name of the frontend IP configuration exposing this rule. 60 * `protocol` - (Required) The transport protocol for the external endpoint. Possible values are `Udp` or `Tcp`. 61 * `frontend_port` - (Required) The port for the external endpoint. Port numbers for each Rule must be unique within the Load Balancer. Possible values range between 1 and 65534, inclusive. 62 * `backend_port` - (Required) The port used for internal connections on the endpoint. Possible values range between 1 and 65535, inclusive. 63 64 ## Attributes Reference 65 66 The following attributes are exported: 67 68 * `id` - The ID of the LoadBalancer to which the resource is attached. 69 70 ## Import 71 72 Load Balancer NAT Rules can be imported using the `resource id`, e.g. 73 74 ``` 75 terraform import azurerm_lb_nat_rule.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/rule1 76 ```