awscc_elasticloadbalancingv2_target_group (Resource)

Resource Type definition for AWS::ElasticLoadBalancingV2::TargetGroup

Example Usage

Instances Target Type

resource "awscc_elasticloadbalancingv2_target_group" "instance-example" {
  name     = "instance-example"
  port     = 80
  protocol = "HTTP"
  vpc_id   = awscc_ec2_vpc.main.id
  tags = [{
    key   = "Modified By"
    value = "AWSCC"
  }]
}

resource "awscc_ec2_vpc" "main" {
  cidr_block = "10.0.0.0/16"
  tags = [
    {
      key   = "Name"
      value = "main"
    },
    {
      key   = "Modified By"
      value = "AWSCC"
    }
  ]
}

IP Addresses Target Type

resource "awscc_elasticloadbalancingv2_target_group" "ip-example" {
  name        = "ip-example"
  port        = 80
  protocol    = "HTTP"
  target_type = "ip"
  vpc_id      = awscc_ec2_vpc.main.id
  tags = [{
    key   = "Modified By"
    value = "AWSCC"
  }]
}

Lambda Function Target Type

resource "awscc_elasticloadbalancingv2_target_group" "lambda-example" {
  name        = "lambda-example"
  target_type = "lambda"
  tags = [{
    key   = "Modified By"
    value = "AWSCC"
  }]
}

Application Load Balancer Target Type

resource "awscc_elasticloadbalancingv2_target_group" "alb-example" {
  name        = "alb-example"
  port        = 80
  protocol    = "TCP"
  target_type = "alb"
  vpc_id      = awscc_ec2_vpc.main.id
  tags = [{
    key   = "Modified By"
    value = "AWSCC"
  }]
}

Schema

Optional

Read-Only

Nested Schema for matcher

Optional:

Nested Schema for tags

Required:

Nested Schema for target_group_attributes

Optional:

Nested Schema for targets

Required:

Optional:

Import

Import is supported using the following syntax:

$ terraform import awscc_elasticloadbalancingv2_target_group.example <resource ID>