RDS · Data

DBSubnetGroup

Manage database subnet groups across availability zones.

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

Resource definition

What this resource looks like

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

CUE example
resources: {
  dbSubnetGroup: {
  	apiVersion: "praxis.io/alpha"
  	kind:       "DBSubnetGroup"
  	metadata: name: "\(_naming.prefix)-db-subnets"
  	spec: {
  		region:      _naming.region
  		description: "Database subnet group for \(_naming.prefix)"
  		subnetIds: [
  			"${resources.dataSubnetA.outputs.subnetId}",
  			"${resources.dataSubnetB.outputs.subnetId}",
  		]
  		tags: #DataTags
  	}
  }
}

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 4 fields. 4 are required by the schema; fields with defaults can be omitted.

regionRequired

Region.

string
String
descriptionRequired

Description.

string
String
subnetIdsRequired

Subnet IDs.

[...string] & [_, _, ...]
List
tagsRequired

Tags.

[string]: string
Map

Observed values

Outputs

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

groupNameString
arnString
vpcIdString
subnetIdsList
availabilityZonesList
statusString

Read without ownership

Data-source lookup

A data block reads an existing DBSubnetGroup 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: "DBSubnetGroup"
  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 DBSubnetGroup. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import DBSubnetGroup \
  --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/rds/db_subnet_group.cue
package rds

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

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

	spec: {
		region:      string
		description: string
		subnetIds: [...string] & [_, _, ...]
		tags: [string]: string
	}

	outputs?: {
		groupName: string
		arn:       string
		vpcId:     string
		subnetIds: [...string]
		availabilityZones: [...string]
		status: string
	}
}

View this schema on GitHub →