VPC · Networking

VPC

Manage VPC address space, DNS settings, tenancy, and tags.

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

Resource definition

What this resource looks like

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

CUE example
resources: network: {
  apiVersion: "praxis.io/alpha"
  kind: "VPC"
  metadata: {name: "payments", labels: {}}
  spec: {
    region: "us-west-2"
    cidrBlock: "10.42.0.0/16"
    enableDnsHostnames: true
    enableDnsSupport: true
    tags: environment: "prod"
  }
}

Desired state

Configuration

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

regionRequired

region is the AWS region to create the VPC in.

string
String
cidrBlockRequired

cidrBlock is the primary IPv4 CIDR block for the VPC. Must be a valid CIDR in the range /16 to /28. Immutable after creation — changing this requires VPC replacement.

string & =~"^([0-9]{1,3}\\.){3}[0-9]{1,3}/([0-9]|[12][0-9]|3[0-2])$"
Enum
enableDnsHostnamesOptional

enableDnsHostnames controls whether instances in the VPC receive public DNS hostnames. Requires enableDnsSupport to be true. Default: false for non-default VPCs.

bool | *false
BooleanDefault false
enableDnsSupportOptional

enableDnsSupport controls whether DNS resolution is supported in the VPC. Default: true.

bool | *true
BooleanDefault true
instanceTenancyOptional

instanceTenancy defines the default tenancy for instances launched into this VPC. Once set to "dedicated", it cannot be changed back to "default" (AWS restriction). - "default": instances launch on shared hardware (most common). - "dedicated": instances launch on single-tenant hardware (higher cost). Immutable after creation.

"default" | "dedicated" | *"default"
EnumDefault "default"
tagsRequired

tags applied to the VPC resource.

[string]: string
Map

Observed values

Outputs

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

vpcIdString
arnString
cidrBlockString
stateString
enableDnsHostnamesBoolean
enableDnsSupportBoolean
instanceTenancyString
ownerIdString
dhcpOptionsIdString
isDefaultBoolean

Read without ownership

Data-source lookup

A data block reads an existing VPC 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: "VPC"
  region: "us-west-2"
  filter: {
    name: "replace-with-provider-name"
  }
}
Documented selectorsidnametag

Understand data sources and filters →

Adopt existing infrastructure

Import

Import persists Praxis state for an existing AWS resource. For this kind, supply: VPC ID and region, for example vpc-0123456789abcdef0 in us-west-2. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import VPC \
  --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/vpc/vpc.cue
package vpc

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

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

	spec: {
		// region is the AWS region to create the VPC in.
		region: string

		// cidrBlock is the primary IPv4 CIDR block for the VPC.
		// Must be a valid CIDR in the range /16 to /28.
		// Immutable after creation — changing this requires VPC replacement.
		cidrBlock: string & =~"^([0-9]{1,3}\\.){3}[0-9]{1,3}/([0-9]|[12][0-9]|3[0-2])$"

		// enableDnsHostnames controls whether instances in the VPC receive
		// public DNS hostnames. Requires enableDnsSupport to be true.
		// Default: false for non-default VPCs.
		enableDnsHostnames: bool | *false

		// enableDnsSupport controls whether DNS resolution is supported in the VPC.
		// Default: true.
		enableDnsSupport: bool | *true

		// instanceTenancy defines the default tenancy for instances launched
		// into this VPC. Once set to "dedicated", it cannot be changed back
		// to "default" (AWS restriction).
		// - "default": instances launch on shared hardware (most common).
		// - "dedicated": instances launch on single-tenant hardware (higher cost).
		// Immutable after creation.
		instanceTenancy: "default" | "dedicated" | *"default"

		// tags applied to the VPC resource.
		tags: [string]: string
	}

	outputs?: {
		vpcId:              string
		arn:                string
		cidrBlock:          string
		state:              string
		enableDnsHostnames: bool
		enableDnsSupport:   bool
		instanceTenancy:    string
		ownerId:            string
		dhcpOptionsId:      string
		isDefault:          bool
	}
}

View this schema on GitHub →