Skip to content

Data Source: awsEc2TransitGatewayVpcAttachments

Get information on EC2 Transit Gateway VPC Attachments.

Example Usage

By Filter

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsEc2TransitGatewayVpcAttachmentsFiltered =
  new aws.dataAwsEc2TransitGatewayVpcAttachments.DataAwsEc2TransitGatewayVpcAttachments(
    this,
    "filtered",
    {
      filter: [
        {
          name: "state",
          values: ["pendingAcceptance"],
        },
      ],
    }
  );
const dataAwsEc2TransitGatewayVpcAttachmentUnit =
  new aws.dataAwsEc2TransitGatewayVpcAttachment.DataAwsEc2TransitGatewayVpcAttachment(
    this,
    "unit",
    {
      id: `\${${dataAwsEc2TransitGatewayVpcAttachmentsFiltered.ids.fqn}[count.index]}`,
    }
  );
/*In most cases loops should be handled in the programming language context and 
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
dataAwsEc2TransitGatewayVpcAttachmentUnit.addOverride(
  "count",
  `\${length(${dataAwsEc2TransitGatewayVpcAttachmentsFiltered.ids})}`
);

Argument Reference

The following arguments are supported:

  • filter - (Optional) One or more configuration blocks containing name-values filters. Detailed below.

filter Argument Reference

  • name - (Required) Name of the filter check available value on official documentation
  • values - (Required) List of one or more values for the filter.

Attribute Reference

In addition to all arguments above, the following attributes are exported:

  • ids A list of all attachments ids matching the filter. You can retrieve more information about the attachment using the aws_ec2_transit_gateway_vpc_attachment data source, searching by identifier.

Timeouts

Configuration options:

  • read - (Default 20M)