aws_internet_gateway
provides details about a specific Internet Gateway.
variable "vpc_id" {}
data "aws_internet_gateway" "default" {
filter {
name = "attachment.vpc-id"
values = [var.vpc_id]
}
}
The arguments of this data source act as filters for querying the available Internet Gateway in the current region. The given filters must match exactly one Internet Gateway whose data will be exported as attributes.
internet_gateway_id
- (Optional) ID of the specific Internet Gateway to retrieve.
tags
- (Optional) Map of tags, each pair of which must exactly match
a pair on the desired Internet Gateway.
filter
- (Optional) Custom filter block as described below.
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.
An Internet Gateway will be selected if any one of the given values matches.
This data source exports the following attributes in addition to the arguments above:
arn
- ARN of the Internet Gateway.All of the argument attributes except filter
block are also exported as
result attributes. This data source will complete the data by populating
any fields that are not included in the configuration with the data for
the selected Internet Gateway.
attachments
are also exported with the following attributes, when there are relevants:
Each attachment supports the following:
owner_id
- ID of the AWS account that owns the internet gateway.state
- Current state of the attachment between the gateway and the VPC. Present only if a VPC is attachedvpc_id
- ID of an attached VPC.read
- (Default 20m
)