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