Skip to content

Outputs

Kyku provides type-safe output proxies that resolve at apply time to cloud-computed values.

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).

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.

Output Type Description
vpcId string Cloud provider VPC ID
cidr string VPC CIDR block
subnetIds string[] Auto-created subnet IDs
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
Output Type Description
endpoint string Database connection endpoint
port number Database listener port
databaseName string Initial database name
Output Type Description
dnsName string LB DNS name for CNAME records
listenerPorts number[] Active listener ports
Output Type Description
bucketName string Bucket name
endpoint string S3-compatible endpoint
arn string AWS ARN
Output Type Description
zoneId string Zone ID
nameServers string[] Delegation name servers

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 creation

Custom resources can return arbitrary outputs from their handler:

handler.apply(async (ctx) => ({
providerId: '...',
outputs: {
apiKey: ctx.setSecret('sk-...'),
endpoint: 'https://api.example.com',
},
}));