VPC · Networking

NetworkACL

Manage VPC network ACLs, associations, and entries.

Generic driverUniform lifecycle
Scope
Regional
Spec fields
6
Outputs
6
Lookup
Supported

Resource definition

What this resource looks like

This is the CUE shape a Praxis template uses to declare a NetworkACL. The resource key is local to the template; metadata.name supplies its stable Praxis identity.

CUE example
resources: {
  publicNacl: {
  	apiVersion: "praxis.io/alpha"
  	kind:       "NetworkACL"
  	metadata: name: "\(_naming.prefix)-public-nacl"
  	spec: {
  		region: _naming.region
  		vpcId:  "${resources.vpc.outputs.vpcId}"
  		ingressRules: [
  			{ruleNumber: 100, protocol: "tcp", ruleAction: "allow", cidrBlock: "0.0.0.0/0", fromPort: 80, toPort: 80},
  			{ruleNumber: 110, protocol: "tcp", ruleAction: "allow", cidrBlock: "0.0.0.0/0", fromPort: 443, toPort: 443},
  			{ruleNumber: 200, protocol: "tcp", ruleAction: "allow", cidrBlock: "0.0.0.0/0", fromPort: 1024, toPort: 65535},
  		]
  		egressRules: [
  			{ruleNumber: 100, protocol: "-1", ruleAction: "allow", cidrBlock: "0.0.0.0/0"},
  		]
  		subnetAssociations: [
  			"${resources.publicSubnetA.outputs.subnetId}",
  			"${resources.publicSubnetB.outputs.subnetId}",
  		]
  		tags: #WebTags
  	}
  }
}

Excerpted from examples/stacks/end-to-end.cue. Open the complete example for its variables and related resources.

Complete examples in the repository

Desired state

Configuration

The spec block accepts 6 fields. 2 are required by the schema; fields with defaults can be omitted.

regionRequired

Region.

string
String
vpcIdRequired

Vpc ID.

string
String
ingressRulesOptional

Ingress Rules.

[...#NetworkACLRule]
List
egressRulesOptional

Egress Rules.

[...#NetworkACLRule]
List
subnetAssociationsOptional

Subnet Associations.

[...string]
List
tagsOptional

Tags.

[string]: string
Map

Observed values

Outputs

Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.

networkAclIdString
vpcIdString
isDefaultBoolean
ingressRulesList
egressRulesList
associationsList

Read without ownership

Data-source lookup

A data block reads an existing NetworkACL and exposes its outputs without storing lifecycle state. The generic filter surface accepts id, name, and tag; supported combinations depend on the AWS identity used by this resource.

CUE data source
data: existing: {
  kind: "NetworkACL"
  region: "us-west-2"
  filter: {
    name: "replace-with-provider-name"
  }
}

Understand data sources and filters →

Adopt existing infrastructure

Import

Import persists Praxis state for an existing AWS resource. For this kind, supply: Provider identifier for the existing NetworkACL. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import NetworkACL \
  --id <provider-identifier> \
  --region us-west-2 \
  --account production \
  --observe

Choose managed or observed ownership →

Canonical contract

Complete CUE schema

The field guide above is derived from this definition. The schema remains the source of truth for accepted values, defaults, validation constraints, and outputs in the current alpha revision.

Show the complete schema
schemas/aws/nacl/nacl.cue
package nacl

#NetworkACL: {
	apiVersion: "praxis.io/alpha"
	kind:       "NetworkACL"

	metadata: {
		name: string & =~"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}$"
		labels: [string]: string
	}

	spec: {
		region: string
		vpcId:  string

		ingressRules?: [...#NetworkACLRule]
		egressRules?: [...#NetworkACLRule]
		subnetAssociations?: [...string]
		tags?: [string]: string
	}

	outputs?: {
		networkAclId: string
		vpcId:        string
		isDefault:    bool
		ingressRules: [...#NetworkACLRuleOutput]
		egressRules: [...#NetworkACLRuleOutput]
		associations: [...#NetworkACLAssociationOutput]
	}
}

#NetworkACLRule: {
	ruleNumber: int & >=1 & <=32766
	protocol:   string
	ruleAction: "allow" | "deny"
	cidrBlock:  string
	fromPort?:  int
	toPort?:    int
}

#NetworkACLRuleOutput: {
	ruleNumber: int
	protocol:   string
	ruleAction: string
	cidrBlock:  string
	fromPort:   int
	toPort:     int
}

#NetworkACLAssociationOutput: {
	associationId: string
	subnetId:      string
}

View this schema on GitHub →