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

     1  ---
     2  layout: "digitalocean"
     3  page_title: "DigitalOcean: digitalocean_loadbalancer"
     4  sidebar_current: "docs-do-resource-loadbalancer"
     5  description: |-
     6    Provides a DigitalOcean Load Balancer resource. This can be used to create, modify, and delete Load Balancers.
     7  ---
     8  
     9  # digitalocean\_loadbalancer
    10  
    11  Provides a DigitalOcean Load Balancer resource. This can be used to create,
    12  modify, and delete Load Balancers.
    13  
    14  ## Example Usage
    15  
    16  ```hcl
    17  resource "digitalocean_droplet" "web" {
    18    name      = "web-1"
    19    size      = "512mb"
    20    image     = "centos-7-x64"
    21    region    = "nyc3"
    22  }
    23  
    24  resource "digitalocean_loadbalancer" "public" {
    25    name = "loadbalancer-1"
    26    region = "nyc3"
    27  
    28    forwarding_rule {
    29      entry_port = 80
    30      entry_protocol = "http"
    31  
    32      target_port = 80
    33      target_protocol = "http"
    34    }
    35  
    36    healthcheck {
    37      port = 22
    38      protocol = "tcp"
    39    }
    40  
    41    droplet_ids = ["${digitalocean_droplet.web.id}"]
    42  }
    43  ```
    44  
    45  ## Argument Reference
    46  
    47  The following arguments are supported:
    48  
    49  * `name` - (Required) The Load Balancer name
    50  * `region` - (Required) The region to start in
    51  * `algorithm` - (Optional) The load balancing algorithm used to determine
    52  which backend Droplet will be selected by a client. It must be either `round_robin`
    53  or `least_connections`. The default value is `round_robin`.
    54  * `forwarding_rule` - (Required) A list of `forwarding_rule` to be assigned to the
    55  Load Balancer. The `forwarding_rule` block is documented below.
    56  * `healthcheck` - (Optional) A `healthcheck` block to be assigned to the
    57  Load Balancer. The `healthcheck` block is documented below. Only 1 healthcheck is allowed.
    58  * `sticky_sessions` - (Optional) A `sticky_sessions` block to be assigned to the
    59  Load Balancer. The `sticky_sessions` block is documented below. Only 1 sticky_sessions block is allowed.
    60  * `redirect_http_to_https` - (Optional) A boolean value indicating whether
    61  HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443.
    62  Default value is `false`.
    63  * `droplet_ids` (Optional) - A list of the IDs of each droplet to be attached to the Load Balancer.
    64  * `droplet_tag` (Optional) - The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer.
    65  
    66  `forwarding_rule` supports the following:
    67  
    68  * `entry_protocol` - (Required) The protocol used for traffic to the Load Balancer. The possible values are: `http`, `https`, or `tcp`.
    69  * `entry_port` - (Required) An integer representing the port on which the Load Balancer instance will listen.
    70  * `target_protocol` - (Required) The protocol used for traffic from the Load Balancer to the backend Droplets. The possible values are: `http`, `https`, or `tcp`.
    71  * `target_port` - (Required) An integer representing the port on the backend Droplets to which the Load Balancer will send traffic.
    72  * `certificate_id` - (Optional) The ID of the TLS certificate to be used for SSL termination.
    73  * `tls_passthrough` - (Optional) A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets. The default value is `false`.
    74  
    75  `sticky_sessions` supports the following:
    76  
    77  * `type` - (Required) An attribute indicating how and if requests from a client will be persistently served by the same backend Droplet. The possible values are `cookies` or `none`. If not specified, the default value is `none`.
    78  * `cookie_name` - (Optional) The name to be used for the cookie sent to the client. This attribute is required when using `cookies` for the sticky sessions type.
    79  * `cookie_ttl_seconds` - (Optional) The number of seconds until the cookie set by the Load Balancer expires. This attribute is required when using `cookies` for the sticky sessions type.
    80  
    81  
    82  `healthcheck` supports the following:
    83  
    84  * `protocol` - (Required) The protocol used for health checks sent to the backend Droplets. The possible values are `http` or `tcp`.
    85  * `port` - (Optional) An integer representing the port on the backend Droplets on which the health check will attempt a connection.
    86  * `path` - (Optional) The path on the backend Droplets to which the Load Balancer instance will send a request.
    87  * `check_interval_seconds` - (Optional) The number of seconds between between two consecutive health checks. If not specified, the default value is `10`.
    88  * `response_timeout_seconds` - (Optional) The number of seconds the Load Balancer instance will wait for a response until marking a health check as failed. If not specified, the default value is `5`.
    89  * `unhealthy_threshold` - (Optional) The number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool. If not specified, the default value is `3`.
    90  * `healthy_threshold` - (Optional) The number of times a health check must pass for a backend Droplet to be marked "healthy" and be re-added to the pool. If not specified, the default value is `5`.
    91  
    92  
    93  ## Attributes Reference
    94  
    95  The following attributes are exported:
    96  
    97  * `id` - The ID of the Load Balancer
    98  * `ip`- The ip of the Load Balancer