Data Source: aws_route#
Provides information about a route.
Example usage#
Basic example#
The following example shows how a CIDR value may be used to find the ID of a network interface and read the network interface data using the data source.
variable "subnet_id" {}
data "aws_route_table" "selected" {
subnet_id = var.subnet_id
}
data "aws_route" "route" {
route_table_id = data.aws_route_table.selected.id
destination_cidr_block = "10.0.1.0/24"
}
data "aws_network_interface" "interface" {
id = data.aws_route.route.network_interface_id
}
Argument reference#
The arguments of this data source act as filters for querying specific routes in the current region.
~> Note The given filters must exactly match the resource whose data will be exported as attributes.
route_table_id- (Required, String) The ID of the specific route table containing the route entry.destination_cidr_block- (Optional, String) The CIDR block of the route.gateway_id- (Optional, String) The ID of the internet gateway.instance_id- (Optional, String) The ID of the instance.network_interface_id- (Optional, String) The ID of the network interface.transit_gateway_id- (Optional, String) The ID of the transit gateway.
Attribute reference#
All arguments are exported as attributes.
Unsupported attributes#
~> Note These arguments may be present in the terraform.tfstate file, but they have preset values and cannot be specified in configuration files.
The following arguments are not currently supported:
carrier_gateway_id, core_network_arn, destination_ipv6_cidr_block, destination_prefix_list_id, egress_only_gateway_id, local_gateway_id, nat_gateway_id, vpc_endpoint_id, vpc_peering_connection_id.