Data Source: aws_route

aws_route provides details about a specific Route.

This resource can prove useful when finding the resource associated with a CIDR. For example, finding the peering connection associated with a CIDR value.

Example Usage

The following example shows how one might use a CIDR value to find a network interface id and use this to create a data source of that network interface.

variable "subnet_id" {}

data "aws_route_table" "selected" {
  subnet_id = var.subnet_id
}

data "aws_route" "route" {
  route_table_id         = 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 the available Route in the current region. The given filters must match exactly oneRoute whose data will be exported as attributes.

The following arguments are required:

The following arguments are optional:

Attribute Reference

All of the argument attributes are also exported as result attributes when there is data available. For example, the vpc_peering_connection_id field will be empty when the route is attached to a Network Interface.

Timeouts

Configuration options: