Skip to content

Data Source: aws_network_interfaces#

Provides a list of network interface IDs matching the specified criteria.

Example usage#

Basic examples#

The following example retrieves the IDs of all network interfaces.

data "aws_network_interfaces" "example" {}

output "example" {
  value = data.aws_network_interfaces.example.ids
}

The following example retrieves the IDs of network interfaces with a custom Name tag set to test.

data "aws_network_interfaces" "example1" {
  tags = {
    Name = "test"
  }
}

output "example1" {
  value = data.aws_network_interfaces.example.ids
}

The following example retrieves the IDs of network interfaces associated with the specific subnet.

data "aws_network_interfaces" "example2" {
  filter {
    name   = "subnet-id"
    values = ["subnet-xxxxxxxx"]
  }
}

output "example2" {
  value = data.aws_network_interfaces.example.ids
}

Argument reference#

  • filter - (Optional, Block) One or more name/value pairs to use as filters.
  • tags - (Optional, Map of strings) Key-value pairs. Must exactly match pairs on the required resources.

filter#

  • name - (Required, String) The name of the filter.
    • Constraints: Filter names are case-sensitive
  • values - (Required, List of strings) One or more filter values.
    • Constraints: Filter values are case-sensitive

Attribute reference#

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

  • id - (String) The region.
    • Example: ru-spb
  • ids - (List of strings) The list of all the network interface IDs found.