github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/r/alb_target_group.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_alb_target_group" 4 sidebar_current: "docs-aws-resource-alb-target-group" 5 description: |- 6 Provides a Target Group resource for use with Application Load 7 Balancers. 8 --- 9 10 # aws\_alb\_target\_group 11 12 Provides a Target Group resource for use with Application Load Balancer 13 resources. 14 15 ## Example Usage 16 17 ```hcl 18 resource "aws_alb_target_group" "test" { 19 name = "tf-example-alb-tg" 20 port = 80 21 protocol = "HTTP" 22 vpc_id = "${aws_vpc.main.id}" 23 } 24 25 resource "aws_vpc" "main" { 26 cidr_block = "10.0.0.0/16" 27 } 28 ``` 29 30 ## Argument Reference 31 32 The following arguments are supported: 33 34 * `name` - (Optional, Forces new resource) The name of the target group. If omitted, Terraform will assign a random, unique name. 35 * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. 36 * `port` - (Required) The port on which targets receive traffic, unless overridden when registering a specific target. 37 * `protocol` - (Required) The protocol to use for routing traffic to the targets. 38 * `vpc_id` - (Required) The identifier of the VPC in which to create the target group. 39 * `deregistration_delay` - (Optional) The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds. 40 * `stickiness` - (Optional) A Stickiness block. Stickiness blocks are documented below. 41 * `health_check` - (Optional) A Health Check block. Health Check blocks are documented below. 42 * `tags` - (Optional) A mapping of tags to assign to the resource. 43 44 Stickiness Blocks (`stickiness`) support the following: 45 46 * `type` - (Required) The type of sticky sessions. The only current possible value is `lb_cookie`. 47 * `cookie_duration` - (Optional) The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds). 48 * `enabled` - (Optional) Boolean to enable / disable `stickiness`. Default is `true` 49 50 Health Check Blocks (`health_check`) support the following: 51 52 * `interval` - (Optional) The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. Default 30 seconds. 53 * `path` - (Optional) The destination for the health check request. Default `/`. 54 * `port` - (Optional) The port to use to connect with the target. Valid values are either ports 1-65536, or `traffic-port`. Defaults to `traffic-port`. 55 * `protocol` - (Optional) The protocol to use to connect with the target. Defaults to `HTTP`. 56 * `timeout` - (Optional) The amount of time, in seconds, during which no response means a failed health check. Defaults to 5 seconds. 57 * `healthy_threshold` - (Optional) The number of consecutive health checks successes required before considering an unhealthy target healthy. Defaults to 5. 58 * `unhealthy_threshold` - (Optional) The number of consecutive health check failures required before considering the target unhealthy. Defaults to 2. 59 * `matcher` (Optional) The HTTP codes to use when checking for a successful response from a target. Defaults to `200`. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299"). 60 61 ## Attributes Reference 62 63 The following attributes are exported in addition to the arguments listed above: 64 65 * `id` - The ARN of the Target Group (matches `arn`) 66 * `arn` - The ARN of the Target Group (matches `id`) 67 * `arn_suffix` - The ARN suffix for use with CloudWatch Metrics. 68 69 ## Import 70 71 Target Groups can be imported using their ARN, e.g. 72 73 ``` 74 $ terraform import aws_alb_target_group.app_front_end arn:aws:elasticloadbalancing:us-west-2:187416307283:targetgroup/app-front-end/20cfe21448b66314 75 ```