Skip to content

Data Source: aws_network_acls#

Provides a list of network ACL IDs for a VPC.

Example usage#

Basic example#

The following example shows all network ACL IDs in a VPC.

variable vpc_id {}

data "aws_network_acls" "example" {
  vpc_id = var.vpc_id
}

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

Specific examples#

The following example retrieves a list of all network ACLs associated with a VPC with a custom Tier tag set to Private.

variable vpc_id {}

data "aws_network_acls" "example" {
  vpc_id = var.vpc_id

  tags = {
    Tier = "Private"
  }
}

The following example retrieves the ID of a network ACL which is associated with a specific subnet in a VPC.

variable vpc_id {}
variable subnet_id {}

data "aws_network_acls" "example" {
  vpc_id = var.vpc_id

  filter {
    name   = "association.subnet-id"
    values = [var.subnet_id]
  }
}

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.
  • vpc_id - (Optional, String) The ID of the VPC that you want to filter from.

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 ACL IDs found.