NetworkAcl

Provides an network ACL resource. You might set up network ACLs with rules similar to your security groups in order to add an additional layer of security to your VPC.

NOTE on Network ACLs and Network ACL Rules: This provider currently provides both a standalone Network ACL Rule resource and a Network ACL resource with rules defined in-line. At this time you cannot use a Network ACL with in-line rules in conjunction with any Network ACL Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var main = new Aws.Ec2.NetworkAcl("main", new Aws.Ec2.NetworkAclArgs
        {
            Egress = 
            {
                new Aws.Ec2.Inputs.NetworkAclEgressArgs
                {
                    Action = "allow",
                    CidrBlock = "10.3.0.0/18",
                    FromPort = 443,
                    Protocol = "tcp",
                    RuleNo = 200,
                    ToPort = 443,
                },
            },
            Ingress = 
            {
                new Aws.Ec2.Inputs.NetworkAclIngressArgs
                {
                    Action = "allow",
                    CidrBlock = "10.3.0.0/18",
                    FromPort = 80,
                    Protocol = "tcp",
                    RuleNo = 100,
                    ToPort = 80,
                },
            },
            Tags = 
            {
                { "Name", "main" },
            },
            VpcId = aws_vpc.Main.Id,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := ec2.NewNetworkAcl(ctx, "main", &ec2.NetworkAclArgs{
            Egress: ec2.NetworkAclEgressArray{
                &ec2.NetworkAclEgressArgs{
                    Action:    pulumi.String("allow"),
                    CidrBlock: pulumi.String("10.3.0.0/18"),
                    FromPort:  pulumi.Int(443),
                    Protocol:  pulumi.String("tcp"),
                    RuleNo:    pulumi.Int(200),
                    ToPort:    pulumi.Int(443),
                },
            },
            Ingress: ec2.NetworkAclIngressArray{
                &ec2.NetworkAclIngressArgs{
                    Action:    pulumi.String("allow"),
                    CidrBlock: pulumi.String("10.3.0.0/18"),
                    FromPort:  pulumi.Int(80),
                    Protocol:  pulumi.String("tcp"),
                    RuleNo:    pulumi.Int(100),
                    ToPort:    pulumi.Int(80),
                },
            },
            Tags: pulumi.StringMap{
                "Name": pulumi.String("main"),
            },
            VpcId: pulumi.String(aws_vpc.Main.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

main = aws.ec2.NetworkAcl("main",
    egress=[{
        "action": "allow",
        "cidr_block": "10.3.0.0/18",
        "from_port": 443,
        "protocol": "tcp",
        "ruleNo": 200,
        "to_port": 443,
    }],
    ingress=[{
        "action": "allow",
        "cidr_block": "10.3.0.0/18",
        "from_port": 80,
        "protocol": "tcp",
        "ruleNo": 100,
        "to_port": 80,
    }],
    tags={
        "Name": "main",
    },
    vpc_id=aws_vpc["main"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const main = new aws.ec2.NetworkAcl("main", {
    egress: [{
        action: "allow",
        cidrBlock: "10.3.0.0/18",
        fromPort: 443,
        protocol: "tcp",
        ruleNo: 200,
        toPort: 443,
    }],
    ingress: [{
        action: "allow",
        cidrBlock: "10.3.0.0/18",
        fromPort: 80,
        protocol: "tcp",
        ruleNo: 100,
        toPort: 80,
    }],
    tags: {
        Name: "main",
    },
    vpcId: aws_vpc_main.id,
});

Create a NetworkAcl Resource

def NetworkAcl(resource_name, opts=None, egress=None, ingress=None, subnet_ids=None, tags=None, vpc_id=None, __props__=None);
func NewNetworkAcl(ctx *Context, name string, args NetworkAclArgs, opts ...ResourceOption) (*NetworkAcl, error)
public NetworkAcl(string name, NetworkAclArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NetworkAclArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkAclArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkAclArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

NetworkAcl Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The NetworkAcl resource accepts the following input properties:

VpcId string

The ID of the associated VPC.

Egress List<NetworkAclEgressArgs>

Specifies an egress rule. Parameters defined below.

Ingress List<NetworkAclIngressArgs>

Specifies an ingress rule. Parameters defined below.

SubnetIds List<string>

A list of Subnet IDs to apply the ACL to

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

VpcId string

The ID of the associated VPC.

Egress []NetworkAclEgress

Specifies an egress rule. Parameters defined below.

Ingress []NetworkAclIngress

Specifies an ingress rule. Parameters defined below.

SubnetIds []string

A list of Subnet IDs to apply the ACL to

Tags map[string]string

A mapping of tags to assign to the resource.

vpcId string

The ID of the associated VPC.

egress NetworkAclEgress[]

Specifies an egress rule. Parameters defined below.

ingress NetworkAclIngress[]

Specifies an ingress rule. Parameters defined below.

subnetIds string[]

A list of Subnet IDs to apply the ACL to

tags {[key: string]: string}

A mapping of tags to assign to the resource.

vpc_id str

The ID of the associated VPC.

egress List[NetworkAclEgress]

Specifies an egress rule. Parameters defined below.

ingress List[NetworkAclIngress]

Specifies an ingress rule. Parameters defined below.

subnet_ids List[str]

A list of Subnet IDs to apply the ACL to

tags Dict[str, str]

A mapping of tags to assign to the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkAcl resource produces the following output properties:

Arn string

The ARN of the network ACL

Id string
The provider-assigned unique ID for this managed resource.
OwnerId string

The ID of the AWS account that owns the network ACL.

Arn string

The ARN of the network ACL

Id string
The provider-assigned unique ID for this managed resource.
OwnerId string

The ID of the AWS account that owns the network ACL.

arn string

The ARN of the network ACL

id string
The provider-assigned unique ID for this managed resource.
ownerId string

The ID of the AWS account that owns the network ACL.

arn str

The ARN of the network ACL

id str
The provider-assigned unique ID for this managed resource.
owner_id str

The ID of the AWS account that owns the network ACL.

Look up an Existing NetworkAcl Resource

Get an existing NetworkAcl resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkAclState, opts?: CustomResourceOptions): NetworkAcl
static get(resource_name, id, opts=None, arn=None, egress=None, ingress=None, owner_id=None, subnet_ids=None, tags=None, vpc_id=None, __props__=None);
func GetNetworkAcl(ctx *Context, name string, id IDInput, state *NetworkAclState, opts ...ResourceOption) (*NetworkAcl, error)
public static NetworkAcl Get(string name, Input<string> id, NetworkAclState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Arn string

The ARN of the network ACL

Egress List<NetworkAclEgressArgs>

Specifies an egress rule. Parameters defined below.

Ingress List<NetworkAclIngressArgs>

Specifies an ingress rule. Parameters defined below.

OwnerId string

The ID of the AWS account that owns the network ACL.

SubnetIds List<string>

A list of Subnet IDs to apply the ACL to

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

VpcId string

The ID of the associated VPC.

Arn string

The ARN of the network ACL

Egress []NetworkAclEgress

Specifies an egress rule. Parameters defined below.

Ingress []NetworkAclIngress

Specifies an ingress rule. Parameters defined below.

OwnerId string

The ID of the AWS account that owns the network ACL.

SubnetIds []string

A list of Subnet IDs to apply the ACL to

Tags map[string]string

A mapping of tags to assign to the resource.

VpcId string

The ID of the associated VPC.

arn string

The ARN of the network ACL

egress NetworkAclEgress[]

Specifies an egress rule. Parameters defined below.

ingress NetworkAclIngress[]

Specifies an ingress rule. Parameters defined below.

ownerId string

The ID of the AWS account that owns the network ACL.

subnetIds string[]

A list of Subnet IDs to apply the ACL to

tags {[key: string]: string}

A mapping of tags to assign to the resource.

vpcId string

The ID of the associated VPC.

arn str

The ARN of the network ACL

egress List[NetworkAclEgress]

Specifies an egress rule. Parameters defined below.

ingress List[NetworkAclIngress]

Specifies an ingress rule. Parameters defined below.

owner_id str

The ID of the AWS account that owns the network ACL.

subnet_ids List[str]

A list of Subnet IDs to apply the ACL to

tags Dict[str, str]

A mapping of tags to assign to the resource.

vpc_id str

The ID of the associated VPC.

Supporting Types

NetworkAclEgress

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Action string

The action to take.

FromPort int

The from port to match.

Protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

RuleNo int

The rule number. Used for ordering.

ToPort int

The to port to match.

CidrBlock string

The CIDR block to match. This must be a valid network mask.

IcmpCode int

The ICMP type code to be used. Default 0.

IcmpType int

The ICMP type to be used. Default 0.

Ipv6CidrBlock string

The IPv6 CIDR block.

Action string

The action to take.

FromPort int

The from port to match.

Protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

RuleNo int

The rule number. Used for ordering.

ToPort int

The to port to match.

CidrBlock string

The CIDR block to match. This must be a valid network mask.

IcmpCode int

The ICMP type code to be used. Default 0.

IcmpType int

The ICMP type to be used. Default 0.

Ipv6CidrBlock string

The IPv6 CIDR block.

action string

The action to take.

fromPort number

The from port to match.

protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

ruleNo number

The rule number. Used for ordering.

toPort number

The to port to match.

cidrBlock string

The CIDR block to match. This must be a valid network mask.

icmpCode number

The ICMP type code to be used. Default 0.

icmpType number

The ICMP type to be used. Default 0.

ipv6CidrBlock string

The IPv6 CIDR block.

action str

The action to take.

from_port float

The from port to match.

protocol str

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

ruleNo float

The rule number. Used for ordering.

to_port float

The to port to match.

cidr_block str

The CIDR block to match. This must be a valid network mask.

icmp_code float

The ICMP type code to be used. Default 0.

icmp_type float

The ICMP type to be used. Default 0.

ipv6_cidr_block str

The IPv6 CIDR block.

NetworkAclIngress

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Action string

The action to take.

FromPort int

The from port to match.

Protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

RuleNo int

The rule number. Used for ordering.

ToPort int

The to port to match.

CidrBlock string

The CIDR block to match. This must be a valid network mask.

IcmpCode int

The ICMP type code to be used. Default 0.

IcmpType int

The ICMP type to be used. Default 0.

Ipv6CidrBlock string

The IPv6 CIDR block.

Action string

The action to take.

FromPort int

The from port to match.

Protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

RuleNo int

The rule number. Used for ordering.

ToPort int

The to port to match.

CidrBlock string

The CIDR block to match. This must be a valid network mask.

IcmpCode int

The ICMP type code to be used. Default 0.

IcmpType int

The ICMP type to be used. Default 0.

Ipv6CidrBlock string

The IPv6 CIDR block.

action string

The action to take.

fromPort number

The from port to match.

protocol string

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

ruleNo number

The rule number. Used for ordering.

toPort number

The to port to match.

cidrBlock string

The CIDR block to match. This must be a valid network mask.

icmpCode number

The ICMP type code to be used. Default 0.

icmpType number

The ICMP type to be used. Default 0.

ipv6CidrBlock string

The IPv6 CIDR block.

action str

The action to take.

from_port float

The from port to match.

protocol str

The protocol to match. If using the -1 ‘all’ protocol, you must specify a from and to port of 0.

ruleNo float

The rule number. Used for ordering.

to_port float

The to port to match.

cidr_block str

The CIDR block to match. This must be a valid network mask.

icmp_code float

The ICMP type code to be used. Default 0.

icmp_type float

The ICMP type to be used. Default 0.

ipv6_cidr_block str

The IPv6 CIDR block.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.