Skip to content

Deploy Prefix

Every deployment gets a unique 8-character hex prefix (e.g., a3f27b1d) that is prepended to new cloud resource names. This prevents name collisions between deployments sharing the same cloud account.

  1. On first plan or apply, Kyku generates a random 8-character hex prefix.
  2. The prefix is stored in StateFile.metadata.prefix.
  3. All new resources have the prefix prepended to their name: a3f27b1d-web-server.
  4. The prefix persists across subsequent runs — it’s reused from state.

Resource name properties are proxied automatically:

const vm = new Vm({ id: 'vm-web', name: 'web-server' });
// In provider code: resource.name === "a3f27b1d-web-server"

The prefix is applied via a deep proxy — nested references also get correct names:

const vm = new Vm({
network: vpc, // vpc.name is also proxied
securityGroups: [sg], // sg.name is also proxied
});

Resources already tracked in state keep their original cloud names (whether prefixed or not). Only resources not yet in state get the prefix applied. This ensures backward compatibility with existing deployments.

You can set a custom prefix via EngineOptions.deployPrefix:

const engine = new KykuEngine({
deployPrefix: 'myteam',
});

Or use the --deploy-prefix flag if exposed by the CLI (otherwise, custom prefixes require using the engine API directly).

Providers don’t need changes — they receive resources with already-prefixed names via the proxy. All instanceof checks work correctly (the proxy preserves the prototype chain).

The prefix adds 9 characters (8 hex + dash). Account for this when naming resources:

Provider Name Limit Safe Name Length
Hetzner 63 chars 54 chars
AWS VPC varies ~50 chars
AWS ALB 32 chars 23 chars
GCP 62 chars 53 chars
DigitalOcean 255 chars 246 chars