Outputs
Kyku provides type-safe output proxies that resolve at apply time to cloud-computed values.
How Outputs Work
Section titled “How Outputs Work”Every BaseResource has an outputs property — a Proxy that returns OutputValue placeholder objects:
const vm = new Vm({ ... });const placeholder = vm.outputs.instanceId;// → OutputValue { resourceId: "vm-web", key: "instanceId" }// → toString() → "${output:vm-web:instanceId}"These placeholders are resolved to real cloud values when the resource is created (during apply).
Using Outputs
Section titled “Using Outputs”Outputs are commonly used in load balancer targets:
const webServer = new Vm({ id: 'vm-web', name: 'web-server', // ...});
new LoadBalancer({ id: 'lb-web', name: 'web-lb', vpc: vpc, listeners: [{ port: 80, protocol: 'http', targets: [{ vm: webServer.outputs.instanceId, port: 80 }], }],});The engine resolves webServer.outputs.instanceId to the actual instance ID after the VM is provisioned.
Per-Resource Outputs
Section titled “Per-Resource Outputs”VpcOutputs
Section titled “VpcOutputs”| Output | Type | Description |
|---|---|---|
vpcId |
string |
Cloud provider VPC ID |
cidr |
string |
VPC CIDR block |
subnetIds |
string[] |
Auto-created subnet IDs |
VmOutputs
Section titled “VmOutputs”| Output | Type | Description |
|---|---|---|
instanceId |
string |
Cloud provider instance ID |
publicIp |
string |
Public IP address |
privateIp |
string |
Private IP address |
availabilityZone |
string |
AZ where instance is deployed |
DatabaseOutputs
Section titled “DatabaseOutputs”| Output | Type | Description |
|---|---|---|
endpoint |
string |
Database connection endpoint |
port |
number |
Database listener port |
databaseName |
string |
Initial database name |
LoadBalancerOutputs
Section titled “LoadBalancerOutputs”| Output | Type | Description |
|---|---|---|
dnsName |
string |
LB DNS name for CNAME records |
listenerPorts |
number[] |
Active listener ports |
BucketOutputs
Section titled “BucketOutputs”| Output | Type | Description |
|---|---|---|
bucketName |
string |
Bucket name |
endpoint |
string |
S3-compatible endpoint |
arn |
string |
AWS ARN |
DnsZoneOutputs
Section titled “DnsZoneOutputs”| Output | Type | Description |
|---|---|---|
zoneId |
string |
Zone ID |
nameServers |
string[] |
Delegation name servers |
Output Propagation
Section titled “Output Propagation”The OutputPropagator resolves output references before resources are created:
Parse config → Extract output placeholders ({output:id:key})→ Look up placeholder in state → If found, substitute real value→ If not found yet, resolve after resource creationCustom Resources
Section titled “Custom Resources”Custom resources can return arbitrary outputs from their handler:
handler.apply(async (ctx) => ({ providerId: '...', outputs: { apiKey: ctx.setSecret('sk-...'), endpoint: 'https://api.example.com', },}));