Resource definition
What this resource looks like
This is the CUE shape a Praxis template uses to declare a TargetGroup. The resource key is local to the template; metadata.name supplies its stable Praxis identity.
resources: {
targetGroup: {
apiVersion: "praxis.io/alpha"
kind: "TargetGroup"
metadata: name: "\(_naming.prefix)-app-tg"
spec: {
region: _naming.region
port: 8080
protocol: "HTTP"
vpcId: "${resources.vpc.outputs.vpcId}"
targetType: "instance"
healthCheck: {
path: "/healthz"
protocol: "HTTP"
port: "8080"
healthyThreshold: 3
unhealthyThreshold: 3
interval: 30
timeout: 5
}
tags: #AppTags
}
}
}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 12 fields. 5 are required by the schema; fields with defaults can be omitted.
regionRequiredRegion.
stringaccountOptionalAccount.
stringprotocolRequiredProtocol.
"HTTP" | "HTTPS" | "TCP" | "UDP" | "TLS" | "TCP_UDP"portRequiredPort.
int & >=1 & <=65535vpcIdRequiredVpc ID.
stringtargetTypeOptionalTarget Type.
"instance" | "ip" | "lambda" | *"instance""instance"protocolVersionOptionalProtocol Version.
"HTTP1" | "HTTP2" | "gRPC"healthCheckOptionalHealth Check.
{ protocol: "HTTP" | "HTTPS" | "TCP" | "TLS" | *"HTTP" path?: string port: string | *"traffic-port" healthyThreshold: int & >=2 & <=10 | *5 unhealthyThreshold: int & >=2 & <=10 | *2 interval: int & >=5 & <=300 | *30 timeout: int & >=2 & <=120 | *5 matcher?: string }deregistrationDelayOptionalDeregistration Delay.
int & >=0 & <=3600 | *300300stickinessOptionalStickiness.
{ enabled: bool | *false type: "lb_cookie" | "app_cookie" | "source_ip" | *"lb_cookie" duration: int & >=1 & <=604800 | *86400 }targetsOptionalTargets.
[...#Target] | *[][]tagsRequiredTags.
[string]: stringObserved values
Outputs
Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.
targetGroupArnStringtargetGroupNameStringRead without ownership
Data-source lookup
A data block reads an existing TargetGroup 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: "TargetGroup"
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 TargetGroup. The example starts in observed mode so Praxis reports drift without correcting it.
praxis import TargetGroup \
--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 elb
#TargetGroup: {
apiVersion: "praxis.io/alpha"
kind: "TargetGroup"
metadata: {
name: string & =~"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,30}[a-zA-Z0-9])?$"
labels: [string]: string
}
spec: {
region: string
account?: string
protocol: "HTTP" | "HTTPS" | "TCP" | "UDP" | "TLS" | "TCP_UDP"
port: int & >=1 & <=65535
vpcId: string
targetType: "instance" | "ip" | "lambda" | *"instance"
protocolVersion?: "HTTP1" | "HTTP2" | "gRPC"
healthCheck?: {
protocol: "HTTP" | "HTTPS" | "TCP" | "TLS" | *"HTTP"
path?: string
port: string | *"traffic-port"
healthyThreshold: int & >=2 & <=10 | *5
unhealthyThreshold: int & >=2 & <=10 | *2
interval: int & >=5 & <=300 | *30
timeout: int & >=2 & <=120 | *5
matcher?: string
}
deregistrationDelay: int & >=0 & <=3600 | *300
stickiness?: {
enabled: bool | *false
type: "lb_cookie" | "app_cookie" | "source_ip" | *"lb_cookie"
duration: int & >=1 & <=604800 | *86400
}
targets: [...#Target] | *[]
tags: [string]: string
}
outputs?: {
targetGroupArn: string
targetGroupName: string
}
}
#Target: {
id: string
port?: int & >=1 & <=65535
availabilityZone?: string
}