1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. getNetworkAcls

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

aws.ec2.getNetworkAcls

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

    Example Usage

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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    export = async () => {
        const example = await aws.ec2.getNetworkAcls({
            vpcId: vpcId,
        });
        return {
            example: example.ids,
        };
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.get_network_acls(vpc_id=vpc_id)
    pulumi.export("example", example.ids)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    			VpcId: pulumi.StringRef(vpcId),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("example", example.Ids)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Ec2.GetNetworkAcls.Invoke(new()
        {
            VpcId = vpcId,
        });
    
        return new Dictionary<string, object?>
        {
            ["example"] = example.Apply(getNetworkAclsResult => getNetworkAclsResult.Ids),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Ec2Functions;
    import com.pulumi.aws.ec2.inputs.GetNetworkAclsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = Ec2Functions.getNetworkAcls(GetNetworkAclsArgs.builder()
                .vpcId(vpcId)
                .build());
    
            ctx.export("example", example.applyValue(getNetworkAclsResult -> getNetworkAclsResult.ids()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:ec2:getNetworkAcls
          Arguments:
            vpcId: ${vpcId}
    outputs:
      example: ${example.ids}
    

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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.ec2.getNetworkAcls({
        vpcId: vpcId,
        tags: {
            Tier: "Private",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.get_network_acls(vpc_id=vpc_id,
        tags={
            "Tier": "Private",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    			VpcId: pulumi.StringRef(vpcId),
    			Tags: map[string]interface{}{
    				"Tier": "Private",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Ec2.GetNetworkAcls.Invoke(new()
        {
            VpcId = vpcId,
            Tags = 
            {
                { "Tier", "Private" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Ec2Functions;
    import com.pulumi.aws.ec2.inputs.GetNetworkAclsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = Ec2Functions.getNetworkAcls(GetNetworkAclsArgs.builder()
                .vpcId(vpcId)
                .tags(Map.of("Tier", "Private"))
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:ec2:getNetworkAcls
          Arguments:
            vpcId: ${vpcId}
            tags:
              Tier: Private
    

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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.ec2.getNetworkAcls({
        vpcId: vpcId,
        filters: [{
            name: "association.subnet-id",
            values: [test.id],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.get_network_acls(vpc_id=vpc_id,
        filters=[{
            "name": "association.subnet-id",
            "values": [test["id"]],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _, err := ec2.GetNetworkAcls(ctx, &ec2.GetNetworkAclsArgs{
    VpcId: pulumi.StringRef(vpcId),
    Filters: []ec2.GetNetworkAclsFilter{
    {
    Name: "association.subnet-id",
    Values: interface{}{
    test.Id,
    },
    },
    },
    }, nil);
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Ec2.GetNetworkAcls.Invoke(new()
        {
            VpcId = vpcId,
            Filters = new[]
            {
                new Aws.Ec2.Inputs.GetNetworkAclsFilterInputArgs
                {
                    Name = "association.subnet-id",
                    Values = new[]
                    {
                        test.Id,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Ec2Functions;
    import com.pulumi.aws.ec2.inputs.GetNetworkAclsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = Ec2Functions.getNetworkAcls(GetNetworkAclsArgs.builder()
                .vpcId(vpcId)
                .filters(GetNetworkAclsFilterArgs.builder()
                    .name("association.subnet-id")
                    .values(test.id())
                    .build())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:ec2:getNetworkAcls
          Arguments:
            vpcId: ${vpcId}
            filters:
              - name: association.subnet-id
                values:
                  - ${test.id}
    

    Using getNetworkAcls

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNetworkAcls(args: GetNetworkAclsArgs, opts?: InvokeOptions): Promise<GetNetworkAclsResult>
    function getNetworkAclsOutput(args: GetNetworkAclsOutputArgs, opts?: InvokeOptions): Output<GetNetworkAclsResult>
    def get_network_acls(filters: Optional[Sequence[GetNetworkAclsFilter]] = None,
                         tags: Optional[Mapping[str, str]] = None,
                         vpc_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetNetworkAclsResult
    def get_network_acls_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetNetworkAclsFilterArgs]]]] = None,
                         tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                         vpc_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetNetworkAclsResult]
    func GetNetworkAcls(ctx *Context, args *GetNetworkAclsArgs, opts ...InvokeOption) (*GetNetworkAclsResult, error)
    func GetNetworkAclsOutput(ctx *Context, args *GetNetworkAclsOutputArgs, opts ...InvokeOption) GetNetworkAclsResultOutput

    > Note: This function is named GetNetworkAcls in the Go SDK.

    public static class GetNetworkAcls 
    {
        public static Task<GetNetworkAclsResult> InvokeAsync(GetNetworkAclsArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkAclsResult> Invoke(GetNetworkAclsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkAclsResult> getNetworkAcls(GetNetworkAclsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ec2/getNetworkAcls:getNetworkAcls
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetNetworkAclsFilter>

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    Tags Dictionary<string, string>
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    VpcId string
    VPC ID that you want to filter from.
    Filters []GetNetworkAclsFilter

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    Tags map[string]string
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    VpcId string
    VPC ID that you want to filter from.
    filters List<GetNetworkAclsFilter>

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    tags Map<String,String>
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    vpcId String
    VPC ID that you want to filter from.
    filters GetNetworkAclsFilter[]

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    tags {[key: string]: string}
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    vpcId string
    VPC ID that you want to filter from.
    filters Sequence[GetNetworkAclsFilter]

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    tags Mapping[str, str]
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    vpc_id str
    VPC ID that you want to filter from.
    filters List<Property Map>

    Custom filter block as described below.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    tags Map<String>
    Map of tags, each pair of which must exactly match a pair on the desired network ACLs.
    vpcId String
    VPC ID that you want to filter from.

    getNetworkAcls Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    List of all the network ACL ids found.
    Tags Dictionary<string, string>
    Filters List<GetNetworkAclsFilter>
    VpcId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    List of all the network ACL ids found.
    Tags map[string]string
    Filters []GetNetworkAclsFilter
    VpcId string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    List of all the network ACL ids found.
    tags Map<String,String>
    filters List<GetNetworkAclsFilter>
    vpcId String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    List of all the network ACL ids found.
    tags {[key: string]: string}
    filters GetNetworkAclsFilter[]
    vpcId string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    List of all the network ACL ids found.
    tags Mapping[str, str]
    filters Sequence[GetNetworkAclsFilter]
    vpc_id str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    List of all the network ACL ids found.
    tags Map<String>
    filters List<Property Map>
    vpcId String

    Supporting Types

    GetNetworkAclsFilter

    Name string
    Name of the field to filter by, as defined by the underlying AWS API.
    Values List<string>
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
    Name string
    Name of the field to filter by, as defined by the underlying AWS API.
    Values []string
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
    name String
    Name of the field to filter by, as defined by the underlying AWS API.
    values List<String>
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
    name string
    Name of the field to filter by, as defined by the underlying AWS API.
    values string[]
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
    name str
    Name of the field to filter by, as defined by the underlying AWS API.
    values Sequence[str]
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
    name String
    Name of the field to filter by, as defined by the underlying AWS API.
    values List<String>
    Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi