github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/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 23 listener = [ 24 { 25 "instance_port" = "2111" 26 "lb_port" = "21" 27 "lb_protocol" = "tcp" 28 "bandwidth" = "5" 29 }, 30 { 31 "instance_port" = "8000" 32 "lb_port" = "80" 33 "lb_protocol" = "http" 34 "bandwidth" = "5" 35 }, 36 { 37 "instance_port" = "1611" 38 "lb_port" = "161" 39 "lb_protocol" = "udp" 40 "bandwidth" = "5" 41 }, 42 ] 43 } 44 45 # Create a new load balancer for VPC 46 resource "alicloud_vpc" "default" { 47 # Other parameters... 48 } 49 50 resource "alicloud_vswitch" "default" { 51 # Other parameters... 52 } 53 54 resource "alicloud_slb" "vpc" { 55 name = "test-slb-tf" 56 vswitch_id = "${alicloud_vswitch.default.id}" 57 } 58 ``` 59 60 ## Argument Reference 61 62 The following arguments are supported: 63 64 * `name` - (Optional) The name of the SLB. This name must be unique within your AliCloud account, can have a maximum of 80 characters, 65 must contain only alphanumeric characters or hyphens, such as "-","/",".","_", and must not begin or end with a hyphen. If not specified, 66 Terraform will autogenerate a name beginning with `tf-lb`. 67 * `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". 68 * `internet_charge_type` - (Optional, Forces New Resource) Valid 69 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". 70 * `bandwidth` - (Optional) Valid 71 value is between 1 and 1000, If argument "internet_charge_type" is "paybytraffic", then this value will be ignore. 72 * `listener` - (Optional) Additional SLB listener. See [Block listener](#block-listener) below for details. 73 * `vswitch_id` - (Required for a VPC SLB, Forces New Resource) The VSwitch ID to launch in. 74 75 ## Block listener 76 77 load balance support 4 protocal to listen on, they are `http`,`https`,`tcp`,`udp`, the every listener support which portocal following: 78 79 listener parameter | support protocol | value range | 80 ------------- | ------------- | ------------- | 81 instance_port | http & https & tcp & udp | 1-65535 | 82 lb_port | http & https & tcp & udp | 1-65535 | 83 lb_protocol | http & https & tcp & udp | 84 bandwidth | http & https & tcp & udp | -1 / 1-1000 | 85 scheduler | http & https & tcp & udp | wrr or wlc | 86 sticky_session | http & https | on or off | 87 sticky_session_type | http & https | insert or server | 88 cookie_timeout | http & https | 1-86400 | 89 cookie | http & https | | 90 persistence_timeout | tcp & udp | 0-3600 | 91 health_check | http & https | on or off | 92 health_check_type | tcp | tcp or http | 93 health_check_domain | http & https & tcp | 94 health_check_uri | http & https & tcp | | 95 health_check_connect_port | http & https & tcp & udp | 1-65535 or -520 | 96 healthy_threshold | http & https & tcp & udp | 1-10 | 97 unhealthy_threshold | http & https & tcp & udp | 1-10 | 98 health_check_timeout | http & https & tcp & udp | 1-50 | 99 health_check_interval | http & https & tcp & udp | 1-5 | 100 health_check_http_code | http & https & tcp | http_2xx,http_3xx,http_4xx,http_5xx | 101 ssl_certificate_id | https | | 102 103 104 The listener mapping supports the following: 105 106 * `instance_port` - (Required) The port on which the backend servers are listening. Valid value is between 1 to 65535. 107 * `lb_port` - (Required) The port on which the load balancer is listening. Valid value is between 1 to 65535. 108 * `lb_protocol` - (Required) The protocol to listen on. Valid values are `http` and and `tcp` and `udp`. 109 * `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. 110 * `scheduler` - (Optinal) Scheduling algorithm, Valid Value is `wrr` / `wlc`, Default is "wrr". 111 * `sticky_session` - (Optinal) Whether to enable session persistence, Value: `on` / `off`. 112 * `sticky_session_type` - (Optinal) Mode for handling the cookie. If "sticky_session" is on, the parameter is mandatory, and if "sticky_session" is off, the parameter will be ignored. Value:`insert` / `server`. If it is set to insert, it means it is inserted from Server Load Balancer; and if it is set to server, it means the Server Load Balancer learns from the backend server. 113 * `cookie_timeout` - (Optinal) The parameter is mandatory when "sticky_session" is on and "sticky_session_type" is insert. Otherwise, it will be ignored. Value: 1-86400(in seconds) 114 * `cookie` - (Optinal) The cookie configured on the server 115 It is mandatory only when "sticky_session" is on and "sticky_session_type" is server; otherwise, the parameter will be ignored. Value:String in line with RFC 2965, with length being 1- 200. It only contains characters such as ASCII codes, English letters and digits instead of the comma, semicolon or spacing, and it cannot start with $. 116 * `persistence_timeout` - (Optinal) Timeout of connection persistence. Value: 0-3600(in seconds) .Default:0 The value 0 indicates to close it. 117 * `health_check` - (Optinal) Whether to enable health check. Value:`on` / `off` 118 * `health_check_type` - (Optinal) Type of health check. Value:`tcp` | `http` , Default:`tcp` . TCP supports TCP and HTTP health check mode, you can select the particular mode depending on your application. 119 * `health_check_domain` - (Optinal) Domain name used for health check. When TCP listener need to use HTTP health check, this parameter will be configured; and when TCP health check is used, the parameter will be ignored. Value: `$_ip | custom string`. Rules of the custom string: its length is limited to 1-80 and only characters such as letters, digits, ‘-‘ and ‘.’ are allowed. When the parameter is set to $_ip by the user, Server Load Balancer uses the private network IP address of each backend server as Domain used for health check. 120 * `health_check_uri` - (Optinal) URI used for health check. When TCP listener need to use HTTP health check, this parameter will be configured; and when TCP health check is used, the parameter will be ignored. 121 Value:Its length is limited to 1-80 and it must start with /. Only characters such as letters, digits, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, #’ and ‘&’ are allowed. 122 * `health_check_connect_port` - (Optinal) Port used for health check. Value: `1-65535`, Default:None. When the parameter is not set, it means the backend server port is used (BackendServerPort). 123 * `healthy_threshold` - (Optinal) Threshold determining the result of the health check is success. Value:`1-10`, Default:3. 124 * `unhealthy_threshold` - (Optinal) Threshold determining the result of the health check is fail. Value:`1-10`, Default:3. 125 * `health_check_timeout` - (Optinal) Maximum timeout of each health check response. When "health_check" is on, the parameter is mandatory; and when "mandatory" is off, the parameter will be ignored. Value:`1-50`(in seconds). Note: If health_check_timeout < health_check_interval, health_check_timeout is invalid, and the timeout is health_check_interval. 126 * `health_check_interval` - (Optinal) Time interval of health checks. 127 When "health_check" is on, the parameter is mandatory; and when "health_check" is off, the parameter will be ignored. Value:`1-5` (in seconds) 128 * `health_check_http_code` - (Optinal) Regular health check HTTP status code. Multiple codes are segmented by “,”. When "health_check" is on, the parameter is mandatory; and when "health_check" is off, the parameter will be ignored. Value:`http_2xx` / `http_3xx` / `http_4xx` / `http_5xx`. 129 * `ssl_certificate_id` - (Optinal) Security certificate ID. 130 131 ## Attributes Reference 132 133 The following attributes are exported: 134 135 * `id` - The ID of the load balancer. 136 * `name` - The name of the load balancer. 137 * `internet` - The internet of the load balancer. 138 * `internet_charge_type` - The internet_charge_type of the load balancer. 139 * `bandwidth` - The bandwidth of the load balancer. 140 * `vswitch_id` - The VSwitch ID of the load balancer. Only available on SLB launched in a VPC. 141 * `address` - The IP address of the load balancer.