Resource definition
What this resource looks like
This is the CUE shape a Praxis template uses to declare a Subnet. The resource key is local to the template; metadata.name supplies its stable Praxis identity.
resources: app: {
apiVersion: "praxis.io/alpha"
kind: "Subnet"
metadata: {name: "app-a", labels: {}}
spec: {
region: "us-west-2"
vpcId: "${resources.network.outputs.vpcId}"
cidrBlock: "10.42.10.0/24"
availabilityZone: "us-west-2a"
mapPublicIpOnLaunch: false
tags: tier: "application"
}
}Desired state
Configuration
The spec block accepts 6 fields. 5 are required by the schema; fields with defaults can be omitted.
regionRequiredregion is the AWS region for the subnet.
stringvpcIdRequiredvpcId is the VPC to create the subnet in.
stringcidrBlockRequiredcidrBlock is the IPv4 CIDR block for the subnet.
string & =~"^([0-9]{1,3}\\.){3}[0-9]{1,3}/([0-9]|[12][0-9]|3[0-2])$"availabilityZoneRequiredavailabilityZone is the AZ to create the subnet in.
stringmapPublicIpOnLaunchOptionalmapPublicIpOnLaunch controls whether instances launched in this subnet receive a public IPv4 address by default.
bool | *falsefalsetagsRequiredtags applied to the subnet resource.
[string]: stringObserved values
Outputs
Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.
subnetIdStringarnStringvpcIdStringcidrBlockStringavailabilityZoneStringavailabilityZoneIdStringmapPublicIpOnLaunchBooleanstateStringownerIdStringavailableIpCountIntegerRead without ownership
Data-source lookup
A data block reads an existing Subnet 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.
data: existing: {
kind: "Subnet"
region: "us-west-2"
filter: {
name: "replace-with-provider-name"
}
}idnametagAdopt existing infrastructure
Import
Import persists Praxis state for an existing AWS resource. For this kind, supply: Subnet ID and region, for example subnet-0123456789abcdef0 in us-west-2. The example starts in observed mode so Praxis reports drift without correcting it.
praxis import Subnet \
--id <provider-identifier> \
--region us-west-2 \
--account production \
--observeCanonical 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
package subnet
#Subnet: {
apiVersion: "praxis.io/alpha"
kind: "Subnet"
metadata: {
name: string & =~"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}$"
labels: [string]: string
}
spec: {
// region is the AWS region for the subnet.
region: string
// vpcId is the VPC to create the subnet in.
vpcId: string
// cidrBlock is the IPv4 CIDR block for the subnet.
cidrBlock: string & =~"^([0-9]{1,3}\\.){3}[0-9]{1,3}/([0-9]|[12][0-9]|3[0-2])$"
// availabilityZone is the AZ to create the subnet in.
availabilityZone: string
// mapPublicIpOnLaunch controls whether instances launched in this subnet
// receive a public IPv4 address by default.
mapPublicIpOnLaunch: bool | *false
// tags applied to the subnet resource.
tags: [string]: string
}
outputs?: {
subnetId: string
arn: string
vpcId: string
cidrBlock: string
availabilityZone: string
availabilityZoneId: string
mapPublicIpOnLaunch: bool
state: string
ownerId: string
availableIpCount: int
}
}