github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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  The listener mapping supports the following:
    78  
    79  * `instance_port` - (Required) The port on which the backend servers are listening. Valid value is between 1 to 65535.
    80  * `lb_port` - (Required) The port on which the load balancer is listening. Valid value is between 1 to 65535.
    81  * `lb_protocol` - (Required) The protocol to listen on. Valid values are `http` and and `tcp` and `udp`.
    82  * `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.
    83  
    84  ## Attributes Reference
    85  
    86  The following attributes are exported:
    87  
    88  * `id` - The ID of the load balancer.
    89  * `name` - The name of the load balancer.
    90  * `internet` - The internet of the load balancer.
    91  * `internet_charge_type` - The internet_charge_type of the load balancer.
    92  * `bandwidth` - The bandwidth of the load balancer.
    93  * `vswitch_id` - The VSwitch ID of the load balancer. Only available on SLB launched in a VPC.
    94  * `address` - The IP address of the load balancer.