github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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 ``` 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` - (Required) The name of the target group. 35 * `port` - (Required) The port on which targets receive traffic, unless overridden when registering a specific target. 36 * `protocol` - (Required) The protocol to use for routing traffic to the targets. 37 * `vpc_id` - (Required) The identifier of the VPC in which to create the target group. 38 * `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. 39 * `stickiness` - (Optional) A Stickiness block. Stickiness blocks are documented below. 40 * `health_check` - (Optional) A Health Check block. Health Check blocks are documented below. 41 * `tags` - (Optional) A mapping of tags to assign to the resource. 42 43 Stickiness Blocks (`stickiness`) support the following: 44 45 * `type` - (Required) The type of sticky sessions. The only current possible value is `lb_cookie`. 46 * `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). 47 * `enabled` - (Optional) Boolean to enable / disable `stickiness`. Default is `true` 48 49 Health Check Blocks (`health_check`) support the following: 50 51 * `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. 52 * `path` - (Optional) The destination for the health check request. Default `/`. 53 * `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`. 54 * `protocol` - (Optional) The protocol to use to connect with the target. Defaults to `HTTP`. 55 * `timeout` - (Optional) The amount of time, in seconds, during which no response means a failed health check. Defaults to 5 seconds. 56 * `healthy_threshold` - (Optional) The number of consecutive health checks successes required before considering an unhealthy target healthy. Defaults to 5. 57 * `unhealthy_threshold` - (Optional) The number of consecutive health check failures required before considering the target unhealthy. Defaults to 2. 58 * `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"). 59 60 ## Attributes Reference 61 62 The following attributes are exported in addition to the arguments listed above: 63 64 * `id` - The ARN of the Target Group (matches `arn`) 65 * `arn` - The ARN of the Target Group (matches `id`) 66 * `arn_suffix` - The ARN suffix for use with CloudWatch Metrics. 67 68 ## Import 69 70 Target Groups can be imported using their ARN, e.g. 71 72 ``` 73 $ terraform import aws_alb_target_group.app_front_end arn:aws:elasticloadbalancing:us-west-2:187416307283:targetgroup/app-front-end/20cfe21448b66314 74 ```