github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/aws/r/elb.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_elb"
     4  sidebar_current: "docs-aws-resource-elb"
     5  description: |-
     6    Provides an Elastic Load Balancer resource.
     7  ---
     8  
     9  # aws\_elb
    10  
    11  Provides an Elastic Load Balancer resource.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  # Create a new load balancer
    17  resource "aws_elb" "bar" {
    18    name = "foobar-terraform-elb"
    19    availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
    20  
    21    access_logs {
    22      bucket = "foo"
    23      bucket_prefix = "bar"
    24      interval = 60
    25    }
    26  
    27    listener {
    28      instance_port = 8000
    29      instance_protocol = "http"
    30      lb_port = 80
    31      lb_protocol = "http"
    32    }
    33  
    34    listener {
    35      instance_port = 8000
    36      instance_protocol = "https"
    37      lb_port = 443
    38      lb_protocol = "https"
    39      ssl_certificate_id = "arn:aws:iam::123456789012:server-certificate/certName"
    40    }
    41  
    42    health_check {
    43      healthy_threshold = 2
    44      unhealthy_threshold = 2
    45      timeout = 3
    46      target = "HTTP:8000/"
    47      interval = 30
    48    }
    49  
    50    instances = ["${aws_instance.foo.id}"]
    51    cross_zone_load_balancing = true
    52    idle_timeout = 400
    53    connection_draining = true
    54    connection_draining_timeout = 400
    55  
    56    tags {
    57      Name = "foobar-terraform-elb"
    58    }
    59  }
    60  ```
    61  
    62  ## Argument Reference
    63  
    64  The following arguments are supported:
    65  
    66  * `name` - (Optional) The name of the ELB. By default generated by terraform.
    67  * `access_logs` - (Optional) An Access Logs block. Access Logs documented below.
    68  * `availability_zones` - (Required for an EC2-classic ELB) The AZ's to serve traffic in.
    69  * `security_groups` - (Optional) A list of security group IDs to assign to the ELB.
    70  * `subnets` - (Required for a VPC ELB) A list of subnet IDs to attach to the ELB.
    71  * `instances` - (Optional) A list of instance ids to place in the ELB pool.
    72  * `internal` - (Optional) If true, ELB will be an internal ELB.
    73  * `listener` - (Required) A list of listener blocks. Listeners documented below.
    74  * `health_check` - (Optional) A health_check block. Health Check documented below.
    75  * `cross_zone_load_balancing` - (Optional) Enable cross-zone load balancing.
    76  * `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60.
    77  * `connection_draining` - (Optional) Boolean to enable connection draining.
    78  * `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain. 
    79  * `tags` - (Optional) A mapping of tags to assign to the resource.
    80  
    81  Exactly one of `availability_zones` or `subnets` must be specified: this
    82  determines if the ELB exists in a VPC or in EC2-classic.
    83  
    84  Access Logs support the following:
    85  
    86  * `bucket` - (Required) The S3 bucket name to store the logs in.
    87  * `bucket_prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured.
    88  * `interval` - (Optional) The publishing interval in minutes. Default: 60 minutes.
    89  
    90  Listeners support the following:
    91  
    92  * `instance_port` - (Required) The port on the instance to route to
    93  * `instance_protocol` - (Required) The protocol to use to the instance. Valid
    94    values are `HTTP`, `HTTPS`, `TCP`, or `SSL`
    95  * `lb_port` - (Required) The port to listen on for the load balancer
    96  * `lb_protocol` - (Required) The protocol to listen on. Valid values are `HTTP`,
    97    `HTTPS`, `TCP`, or `SSL`
    98  * `ssl_certificate_id` - (Optional) The id of an SSL certificate you have
    99  uploaded to AWS IAM. **Only valid when `instance_protocol` and
   100    `lb_protocol` are either HTTPS or SSL**
   101  
   102  Health Check supports the following:
   103  
   104  * `healthy_threshold` - (Required) The number of checks before the instance is declared healthy.
   105  * `unhealthy_threshold` - (Required) The number of checks before the instance is declared unhealthy.
   106  * `target` - (Required) The target of the check.
   107  * `interval` - (Required) The interval between checks.
   108  * `timeout` - (Required) The length of time before the check times out.
   109  
   110  ## Attributes Reference
   111  
   112  The following attributes are exported:
   113  
   114  * `id` - The name of the ELB
   115  * `name` - The name of the ELB
   116  * `dns_name` - The DNS name of the ELB
   117  * `instances` - The list of instances in the ELB
   118  * `source_security_group` - The name of the security group that you can use as
   119    part of your inbound rules for your load balancer's back-end application
   120    instances. Use this for Classic or Default VPC only.
   121  * `source_security_group_id` - The ID of the security group that you can use as
   122    part of your inbound rules for your load balancer's back-end application
   123    instances. Only available on ELBs launch in a VPC.
   124  * `zone_id` - The canonical hosted zone ID of the ELB (to be used in a Route 53 Alias record)