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.
Declare what exists
Section titled “Declare what exists”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.
Check the plan
Section titled “Check the plan”npx alchemy plan --stage home --adoptpnpm exec alchemy plan --stage home --adoptyarn alchemy plan --stage home --adoptThe 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.
npx alchemy deploy --stage home --adoptpnpm exec alchemy deploy --stage home --adoptyarn alchemy deploy --stage home --adoptWithout --adopt, a resource whose object already exists fails the deploy rather than being taken over silently.
Keep what you adopt
Section titled “Keep what you adopt”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.