Skip to content

Data Source: awsNetworkAcls

Example Usage

The following shows outputting all network ACL ids in a vpc.

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 dataAwsNetworkAclsExample = new aws.dataAwsNetworkAcls.DataAwsNetworkAcls(
  this,
  "example",
  {
    vpcId: "${var.vpc_id}",
  }
);
const cdktfTerraformOutputExample = new cdktf.TerraformOutput(
  this,
  "example_1",
  {
    value: dataAwsNetworkAclsExample.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 ACL ids in a VPC with a custom tag of tier set to a value of "Private".

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsNetworkAcls.DataAwsNetworkAcls(this, "example", {
  tags: {
    Tier: "Private",
  },
  vpcId: "${var.vpc_id}",
});

The following example retrieves a network ACL id in a VPC which associated with specific subnet.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsNetworkAcls.DataAwsNetworkAcls(this, "example", {
  filter: [
    {
      name: "association.subnet-id",
      values: ["${aws_subnet.test.id}"],
    },
  ],
  vpcId: "${var.vpc_id}",
});

Argument Reference

  • vpcId - (Optional) VPC ID that you want to filter from.

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

  • 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. A VPC will be selected if any one of the given values matches.

Attributes Reference

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

Timeouts

Configuration options:

  • read - (Default 20M)