Terraform resource: aws lb target group
(Redirected from Aws lb target group)
Jump to navigation
Jump to search
aws_lb_target_group(tf.io)
- Target Group type: ip, used for ECS services
Contents
Examples[edit]
Instance Target Group[edit]
resource "aws_lb_target_group" "test" {
name = "tf-example-lb-tg"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.main.id
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
IP Target Group official example[edit]
resource "aws_lb_target_group" "ip-example" {
name = "tf-example-lb-tg"
port = 80
protocol = "HTTP"
target_type = "ip"
vpc_id = aws_vpc.main.id
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
host_header based forward[edit]
resource "aws_lb_listener_rule" "your_host_rule" { listener_arn = local.your_https_listener_arn priority = 401 action { type = "forward" target_group_arn = aws_lb_target_group.your_tg.arn } condition { host_header { values = [var.yoururl] } }
Attributes reference[edit]
arn_suffix- ARN suffix for use with CloudWatch Metrics.arn- ARN of the Target Group (matches id).id- ARN of the Target Group (matches arn).name- Name of the Target Group.tags_all- A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.type: The type of sticky sessions. The only current possible values arelb_cookie,app_cookiefor ALBs, andsource_ipfor NLBs. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#typefixed_responsehttps://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule#fixed_responsetarget_type:instance(default),iphttps://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#target_typevpc_idprotocol:[1] GENEVE, HTTP, HTTPS, TCP, TCP_UDP, TLS, or UDPprotocol_version(optional): HTTP1 (default), GRPC, HTTP2 [2]health_check[3]
Example Instance Target Group[edit]
resource "aws_lb_target_group" "test" {
name = "tf-example-lb-tg"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.main.id
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
Related terms[edit]
target_group_arnaws_lb_listener_ruledrainingaws_lbResourceInUse- load balancer (argument)
aws elbv2 create-target-group
See also[edit]
- Terraform resource:
aws_lb_target_group,target_group_arn,aws lb target group - fixed response, CreateTargetGroup - Terraform LB:
aws_lb:aws_lb_listener,aws_lb_listener_certificate,aws_lb_listener_rule,aws_lb_target_group,aws_lb_target_group_attachment,load_balancer_type,aws lb listener: default action,aws load balancer policy
Advertising: