Resource definition
What this resource looks like
This is the CUE shape a Praxis template uses to declare a SNSTopic. The resource key is local to the template; metadata.name supplies its stable Praxis identity.
resources: {
alertTopic: {
apiVersion: "praxis.io/alpha"
kind: "SNSTopic"
metadata: name: "\(_naming.prefix)-alerts"
spec: {
region: _naming.region
topicName: "\(_naming.prefix)-alerts"
tags: #StandardTags & {purpose: "alerting"}
}
}
}Excerpted from examples/stacks/end-to-end.cue. Open the complete example for its variables and related resources.
Desired state
Configuration
The spec block accepts 9 fields. 3 are required by the schema; fields with defaults can be omitted.
regionRequiredRegion.
stringtopicNameRequiredTopic Name.
string & =~"^[a-zA-Z0-9_-]{1,256}(\\.fifo)?$"displayNameOptionalDisplay Name.
stringfifoTopicOptionalFifo Topic.
bool | *falsefalsecontentBasedDeduplicationOptionalContent Based Deduplication.
bool | *falsefalsepolicyOptionalOmitted optional attributes are declarative defaults/absence. Re-applying a spec without a previously configured value removes that provider value.
stringdeliveryPolicyOptionalDelivery Policy.
stringkmsMasterKeyIdOptionalKms Master Key ID.
stringtagsRequiredTags.
[string]: stringObserved values
Outputs
Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.
topicArnStringtopicNameStringownerStringRead without ownership
Data-source lookup
A data block reads an existing SNSTopic 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: "SNSTopic"
region: "us-west-2"
filter: {
name: "replace-with-provider-name"
}
}Adopt existing infrastructure
Import
Import persists Praxis state for an existing AWS resource. For this kind, supply: Provider identifier for the existing SNSTopic. The example starts in observed mode so Praxis reports drift without correcting it.
praxis import SNSTopic \
--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 sns
#SNSTopic: {
apiVersion: "praxis.io/alpha"
kind: "SNSTopic"
metadata: {
name: string & =~"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}$"
labels: [string]: string
}
spec: {
region: string
topicName: string & =~"^[a-zA-Z0-9_-]{1,256}(\\.fifo)?$"
displayName?: string
fifoTopic: bool | *false
contentBasedDeduplication: bool | *false
// Omitted optional attributes are declarative defaults/absence. Re-applying
// a spec without a previously configured value removes that provider value.
policy?: string
deliveryPolicy?: string
kmsMasterKeyId?: string
tags: [string]: string
}
outputs?: {
topicArn: string
topicName: string
owner: string
}
}