Skip to content

Data Source: awsLbTargetGroup

\~> Note: awsAlbTargetGroup is known as awsLbTargetGroup. The functionality is identical.

Provides information about a Load Balancer Target Group.

This data source can prove useful when a module accepts an LB Target Group as an input variable and needs to know its attributes. It can also be used to get the ARN of an LB Target Group for use in other resources, given LB Target Group name.

Example Usage

import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
/*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
You can read more about this at https://cdk.tf/variables*/
const lbTgArn = new cdktf.TerraformVariable(this, "lb_tg_arn", {
  default: "",
});
const lbTgName = new cdktf.TerraformVariable(this, "lb_tg_name", {
  default: "",
});
new aws.dataAwsLbTargetGroup.DataAwsLbTargetGroup(this, "test", {
  arn: lbTgArn.value,
  name: lbTgName.value,
});

Argument Reference

The following arguments are supported:

  • arn - (Optional) Full ARN of the target group.
  • name - (Optional) Unique name of the target group.
  • tags - (Optional) Mapping of tags, each pair of which must exactly match a pair on the desired target group.

\~> NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

Attributes Reference

See the LB Target Group Resource for details on the returned attributes - they are identical.

Timeouts

Configuration options:

  • read - (Default 20M)