Data Source: awsVpcPeeringConnections
Use this data source to get IDs of Amazon VPC peering connections To get more details on each connection, use the data resource aws_vpc_peering_connection
Note: To use this data source in a count, the resources should exist before trying to access the data source, as noted in issue 4149
Example Usage
/*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 dataAwsVpcPeeringConnectionsPcs =
new aws.dataAwsVpcPeeringConnections.DataAwsVpcPeeringConnections(
this,
"pcs",
{
filter: [
{
name: "requester-vpc-info.vpc-id",
values: ["${aws_vpc.foo.id}"],
},
],
}
);
const dataAwsVpcPeeringConnectionPc =
new aws.dataAwsVpcPeeringConnection.DataAwsVpcPeeringConnection(this, "pc", {
id: `\${${dataAwsVpcPeeringConnectionsPcs.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.*/
dataAwsVpcPeeringConnectionPc.addOverride(
"count",
`\${length(${dataAwsVpcPeeringConnectionsPcs.ids})}`
);
Argument Reference
The arguments of this data source act as filters for querying the available VPC peering connections.
-
filter
- (Optional) Custom filter block as described below. -
tags
- (Optional) Mapping of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.
More complex filters can be expressed using one or more filter
sub-blocks, which take the following arguments:
-
name
- (Required) Name of the field to filter by, as defined by the underlying AWS API. -
values
- (Required) Set of values that are accepted for the given field. A VPC Peering Connection will be selected if any one of the given values matches.
Attributes Reference
All of the argument attributes except filter
are also exported as result attributes.
id
- AWS Region.ids
- IDs of the VPC Peering Connections.
Timeouts
read
- (Default20M
)