github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/website/source/docs/providers/alicloud/r/slb.html.markdown (about) 1 --- 2 layout: "alicloud" 3 page_title: "Alicloud: alicloud_slb" 4 sidebar_current: "docs-alicloud-resource-slb" 5 description: |- 6 Provides an Application Load Banlancer resource. 7 --- 8 9 # alicloud\_slb 10 11 Provides an Application Load Balancer resource. 12 13 ## Example Usage 14 15 ``` 16 # Create a new load balancer for classic 17 resource "alicloud_slb" "classic" { 18 name = "test-slb-tf" 19 internet = true 20 internet_charge_type = "paybybandwidth" 21 bandwidth = 5 22 listener = [ 23 { 24 "instance_port" = "2111" 25 "lb_port" = "21" 26 "lb_protocol" = "tcp" 27 "bandwidth" = "5" 28 },{ 29 "instance_port" = "8000" 30 "lb_port" = "80" 31 "lb_protocol" = "http" 32 "bandwidth" = "5" 33 },{ 34 "instance_port" = "1611" 35 "lb_port" = "161" 36 "lb_protocol" = "udp" 37 "bandwidth" = "5" 38 }] 39 } 40 41 # Create a new load balancer for VPC 42 resource "alicloud_vpc" "default" { 43 # Other parameters... 44 } 45 46 resource "alicloud_vswitch" "default" { 47 # Other parameters... 48 } 49 50 resource "alicloud_slb" "vpc" { 51 name = "test-slb-tf" 52 vswitch_id = "${alicloud_vswitch.default.id}" 53 } 54 ``` 55 56 ## Argument Reference 57 58 The following arguments are supported: 59 60 * `name` - (Optional) The name of the SLB. This name must be unique within your AliCloud account, can have a maximum of 80 characters, 61 must contain only alphanumeric characters or hyphens, such as "-","/",".","_", and must not begin or end with a hyphen. If not specified, 62 Terraform will autogenerate a name beginning with `tf-lb`. 63 * `internet` - (Optional, Forces New Resource) If true, the SLB addressType will be internet, false will be intranet, Default is false. If load balancer launched in VPC, this value must be "false". 64 * `internet_charge_type` - (Optional, Forces New Resource) Valid 65 values are `paybybandwidth`, `paybytraffic`. If this value is "paybybandwidth", then argument "internet" must be "true". Default is "paybytraffic". If load balancer launched in VPC, this value must be "paybytraffic". 66 * `bandwidth` - (Optional) Valid 67 value is between 1 and 1000, If argument "internet_charge_type" is "paybytraffic", then this value will be ignore. 68 * `listener` - (Optional) Additional SLB listener. See [Block listener](#block-listener) below for details. 69 * `vswitch_id` - (Required for a VPC SLB, Forces New Resource) The VSwitch ID to launch in. 70 71 ## Block listener 72 73 The listener mapping supports the following: 74 75 * `instance_port` - (Required) The port on which the backend servers are listening. Valid value is between 1 to 65535. 76 * `lb_port` - (Required) The port on which the load balancer is listening. Valid value is between 1 to 65535. 77 * `lb_protocol` - (Required) The protocol to listen on. Valid values are `http` and and `tcp` and `udp`. 78 * `bandwidth` - (Required) The bandwidth on which the load balancer is listening. Valid values is -1 or between 1 and 1000. If -1, the bindwidth will haven’t upper limit. 79 80 ## Attributes Reference 81 82 The following attributes are exported: 83 84 * `id` - The ID of the load balancer. 85 * `name` - The name of the load balancer. 86 * `internet` - The internet of the load balancer. 87 * `internet_charge_type` - The internet_charge_type of the load balancer. 88 * `bandwidth` - The bandwidth of the load balancer. 89 * `vswitch_id` - The VSwitch ID of the load balancer. Only available on SLB launched in a VPC. 90 * `address` - The IP address of the load balancer.