Skip to content

Data Source: awsLb

\~> Note: awsAlb is known as awsLb. The functionality is identical.

Provides information about a Load Balancer.

This data source can prove useful when a module accepts an LB as an input variable and needs to, for example, determine the security groups associated with it, etc.

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 lbArn = new cdktf.TerraformVariable(this, "lb_arn", {
  default: "",
});
const lbName = new cdktf.TerraformVariable(this, "lb_name", {
  default: "",
});
new aws.dataAwsLb.DataAwsLb(this, "test", {
  arn: lbArn.value,
  name: lbName.value,
});

Argument Reference

The following arguments are supported:

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

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

Attributes Reference

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

Timeouts

Configuration options:

  • read - (Default 20M)