Skip to content

Adoption

Most consoles already have networks, Wi-Fi and policies. Declare them as resources, then let Alchemy adopt them instead of creating duplicates. Part 2 of the tutorial walks through it with the default network.

Give each resource the same natural key as the object on the console: the name for zones, lists and Wi-Fi, the VLAN ID for networks, the name and zone pair for policies, the type and domain for DNS records. Each reference page says which.

Copy the object’s current settings into the props. Props are authoritative, so a prop you leave out gets its default, and the deploy changes the live object.

Terminal window
npx alchemy plan --stage home --adopt

The plan lists what would be adopted, updated and created. An adopted object with an update means your props differ from the console: fix them until the plan shows only adoptions.

Terminal window
npx alchemy deploy --stage home --adopt

Without --adopt, a resource whose object already exists fails the deploy rather than being taken over silently.

Add RemovalPolicy.retain() to anything you’d want to keep if you remove it from the stack or destroy the stack, like the network your own devices are on. The default network (VLAN 1) is never deleted either way.