SQS · Identity

SQSQueuePolicy

Attach declarative access policies to SQS queues.

Generic driverUniform lifecycle
Scope
Composite
Spec fields
3
Outputs
3
Lookup
Supported

Resource definition

What this resource looks like

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

CUE example
resources: {
  dlqPolicy: {
  	apiVersion: "praxis.io/alpha"
  	kind:       "SQSQueuePolicy"
  	metadata: name: "\(_naming.prefix)-dlq-policy"
  	spec: {
  		region:    _naming.region
  		queueName: "${resources.dlq.outputs.queueName}"
  		policy: {
  			Version: "2012-10-17"
  			Statement: [{
  				Sid:       "AllowSNSPublish"
  				Effect:    "Allow"
  				Principal: Service: "sns.amazonaws.com"
  				Action:   "sqs:SendMessage"
  				Resource: "${resources.dlq.outputs.queueArn}"
  				Condition: ArnEquals: "aws:SourceArn": "${resources.alertTopic.outputs.topicArn}"
  			}]
  		}
  	}
  }
}

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

regionRequired

Region.

string
String
queueNameRequired

Queue Name.

string & (=~"^[a-zA-Z0-9_-]{1,80}(\\.fifo)?$" | =~"^\\$\\{resources\\..+\\}$")
Enum
policyRequired

Policy.

{ Version: "2012-10-17" | "2008-10-17" | *"2012-10-17" Id?: string Statement: [...{ Sid?: string Effect: "Allow" | "Deny" Principal: _ Action: string | [...string] Resource: string | [...string] Condition?: _ }] }
Object

Observed values

Outputs

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

queueUrlString
queueArnString
queueNameString

Read without ownership

Data-source lookup

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

CLI
praxis import SQSQueuePolicy \
  --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/sqs/queue_policy.cue
package sqs

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

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

	spec: {
		region:    string
		queueName: string & (=~"^[a-zA-Z0-9_-]{1,80}(\\.fifo)?$" | =~"^\\$\\{resources\\..+\\}$")
		policy: {
			Version: "2012-10-17" | "2008-10-17" | *"2012-10-17"
			Id?:     string
			Statement: [...{
				Sid?:      string
				Effect:    "Allow" | "Deny"
				Principal: _
				Action: string | [...string]
				Resource: string | [...string]
				Condition?: _
			}]
		}
	}

	outputs?: {
		queueUrl:  string
		queueArn:  string
		queueName: string
	}
}

View this schema on GitHub →