github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/aws/r/alb.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_alb"
     4  sidebar_current: "docs-aws-resource-alb"
     5  description: |-
     6    Provides an Application Load Balancer resource.
     7  ---
     8  
     9  # aws\_alb
    10  
    11  Provides an Application Load Balancer resource.
    12  
    13  The official AWS CLI calls this "elbv2" while their documentation calls it
    14  an Application Load Balancer. Terraform uses "ALB" but they mean the same
    15  thing.
    16  
    17  ## Example Usage
    18  
    19  ```
    20  # Create a new load balancer
    21  resource "aws_alb" "test" {
    22    name            = "test-alb-tf"
    23    internal        = false
    24    security_groups = ["${aws_security_group.alb_sg.id}"]
    25    subnets         = ["${aws_subnet.public.*.id}"]
    26  
    27    enable_deletion_protection = true
    28  
    29    access_logs {
    30      bucket = "${aws_s3_bucket.alb_logs.bucket}"
    31      prefix = "test-alb"
    32    }
    33  
    34    tags {
    35      Environment = "production"
    36    }
    37  }
    38  ```
    39  
    40  ## Argument Reference
    41  
    42  The following arguments are supported:
    43  
    44  * `name` - (Optional) The name of the ALB. This name must be unique within your AWS account, can have a maximum of 32 characters,
    45  must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified,
    46  Terraform will autogenerate a name beginning with `tf-lb`.
    47  * `name_prefix` - (Optional) Creates a unique name beginning with the specified prefix. Conflicts with `name`.
    48  * `internal` - (Optional) If true, the ALB will be internal.
    49  * `security_groups` - (Optional) A list of security group IDs to assign to the ELB.
    50  * `access_logs` - (Optional) An Access Logs block. Access Logs documented below.
    51  * `subnets` - (Required) A list of subnet IDs to attach to the ELB.
    52  * `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Default: 60.
    53  * `enable_deletion_protection` - (Optional) If true, deletion of the load balancer will be disabled via
    54     the AWS API. This will prevent Terraform from deleting the load balancer. Defaults to `false`.
    55  * `tags` - (Optional) A mapping of tags to assign to the resource.
    56  
    57  Access Logs (`access_logs`) support the following:
    58  
    59  * `bucket` - (Required) The S3 bucket name to store the logs in.
    60  * `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured.
    61  * `enabled` = (Optional) Boolean to enable / disable `access_logs`. Default is `true`
    62  
    63  ## Attributes Reference
    64  
    65  The following attributes are exported in addition to the arguments listed above:
    66  
    67  * `id` - The ARN of the load balancer (matches `arn`).
    68  * `arn` - The ARN of the load balancer (matches `id`).
    69  * `arn_suffix` - The ARN suffix for use with CloudWatch Metrics.
    70  * `dns_name` - The DNS name of the load balancer.
    71  * `canonical_hosted_zone_id` - The canonical hosted zone ID of the load balancer.
    72  * `zone_id` - The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record).
    73  
    74  ## Import
    75  
    76  ALBs can be imported using their ARN, e.g.
    77  
    78  ```
    79  $ terraform import aws_alb.bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
    80  ```