Skip to content

Data Source: awsNetworkInterfaces

Example Usage

The following shows outputting all network interface ids in a region.

import * as cdktf from "cdktf";
/*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 dataAwsNetworkInterfacesExample =
  new aws.dataAwsNetworkInterfaces.DataAwsNetworkInterfaces(
    this,
    "example",
    {}
  );
const cdktfTerraformOutputExample = new cdktf.TerraformOutput(
  this,
  "example_1",
  {
    value: dataAwsNetworkInterfacesExample.ids,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
cdktfTerraformOutputExample.overrideLogicalId("example");

The following example retrieves a list of all network interface ids with a custom tag of name set to a value of test.

import * as cdktf from "cdktf";
/*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 dataAwsNetworkInterfacesExample =
  new aws.dataAwsNetworkInterfaces.DataAwsNetworkInterfaces(this, "example", {
    tags: {
      Name: "test",
    },
  });
new cdktf.TerraformOutput(this, "example1", {
  value: dataAwsNetworkInterfacesExample.ids,
});

The following example retrieves a network interface ids which associated with specific subnet.

import * as cdktf from "cdktf";
/*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 dataAwsNetworkInterfacesExample =
  new aws.dataAwsNetworkInterfaces.DataAwsNetworkInterfaces(this, "example", {
    filter: [
      {
        name: "subnet-id",
        values: ["${aws_subnet.test.id}"],
      },
    ],
  });
const cdktfTerraformOutputExample = new cdktf.TerraformOutput(
  this,
  "example_1",
  {
    value: dataAwsNetworkInterfacesExample.ids,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
cdktfTerraformOutputExample.overrideLogicalId("example");

Argument Reference

  • tags - (Optional) Map of tags, each pair of which must exactly match a pair on the desired network interfaces.

  • 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.

Attributes Reference

  • id - AWS Region.
  • ids - List of all the network interface ids found.

Timeouts

Configuration options:

  • read - (Default 20M)