How-to Guides
Goal-oriented recipes for accomplishing specific tasks.
How-to guides assume you already know the basics of Netherframe (if not, start with the Tutorials). Pick the task in front of you and follow the steps directly.
Setup and provider management
- Install Netherframe — install the CLI, core library, provider bindings, and optional backend/lint packages with
uv,pip,uvx, or from source. - Cloud & ecosystem entrypoints (GCP, Azure, Kubernetes) — provider generation, auth, and starter apps beyond AWS.
- Install providers from registries and mirrors — configure network mirrors (Artifactory, Nexus), filesystem mirrors, credentials, and CA bundles.
- Use Netherframe with AI coding agents — inspect and export the versioned
nf skillbundle.
Authoring, structure, and testing
- Organize a Netherframe project — lay out modules, stacks, tests, and
pyproject.toml. - Structure Netherframe at scale — split
Apps vs.Stacks vs. graph state, monorepo vs. multi-repo, and shared construct wheels. - Author reusable constructs — design clean Python abstractions without hiding operational boundaries.
- Use
nf_autoidand@autoscope— inject stablenf_idvalues from explicitBindannotations and context blocks. - Use provider patterns — wire multiple regions, accounts, aliases, and provider contexts.
- Manage multiple environments — parameterize apps cleanly with typed
++inputs, TOML files, and separate state boundaries. - Manage secrets safely — combine
Secret[T],GeneratedValue(write_only_params),EphemeralResource, password files, and masking. - Embed Netherframe in platforms (
nf.sdk) — build internal developer portals, bots, and multi-stage rollouts withProjectandAsyncProject. - Extend Netherframe with plugins — author custom
nf.lint_packs,nf.generators,nf.backends, andnf.discoverers. - Test Netherframe apps — combine offline synthesis tests,
nf.testingharnesses, FakeCloud, and provider-backed checks. - Run offline policy linting — run
nf lint, select packs (such asnetherframe.lint.hashicorp.aws), and author custom rule packs.
Planning, execution, and safety
- Run the day-to-day hybrid workflow — plan, review, save, apply, and verify convergence.
- Work interactively with
nf tuiandnf follow— explore:graph, diffs, read-only guards, live CI runs, and session replay. - Manage the full lifecycle and legacy handoff — work with app selectors, stack targets, and Terraform/OpenTofu export.
- Configure CI/CD with saved plans — split plan review from apply, enforce
--expect-no-changes, and handle JSON output and exit codes. - Add app-wide checks and finalizers — enforce
prerequisites,plan,apply, andfinalizechecks with audit evidence. - Write runtime functions and resource checks — run Python transformations and checks during apply.
- Generate and keep secrets in state — use built-in
GeneratedValuewithouthashicorp/random. - Configure providers from newly created resources — converge clusters and in-cluster resources in one run with deferred rounds.
- Inspect state read provenance — see exactly what a plan or apply reads from state.
Adoption, discovery, and migration
- Import (adopt) existing resources — import live objects via
import_from(),LifecycleRules(adopt=...), or an adoption manifest. - Discover live resources and detect drift — inventory accounts with
nf discoverand runnf drift detect|check|fix. - Codify a Keycloak realm — end-to-end discovery and codification walkthrough for Keycloak.
- Create a discovery package — implement and register a
nf.discoverersplugin.
State, backends, and operations
- Set up state backends & permissions (S3, GCS, Azure, Consul, PostgreSQL, HCP) — copy-pasteable configs, locking behavior, and minimal IAM/RBAC policies.
- Bootstrap and manage state backends —
bootstrap_backend,BackendChain, and custom backend plugins. - Onboard and operate PostgreSQL graph state — row-level state, fenced operations, concurrent applies, and affected-scope planning.
- Perform state operations — inspect, move (
nf state mv), forget (nf state rm), taint, unlock, verify, and recover state. - Refactor live infrastructure without downtime — rename
nf_id, move across stacks, splitApps, and upgrade providers safely. - Recover from a failed apply or crash — use
CHECKPOINT,ROLLBACK,request_stop(), checkpoints, and errored state reconciliation. - Debug failures, configure logging, and profile runs — enable structured logs,
--trace, and consult the debugging playbook. - Tune performance — optimize large construct graphs, parallelism, and provider startup.
- Upgrade Netherframe and providers — upgrade framework packages and regenerate bindings safely; see provider releases for publishing packages.
- Run the production readiness checklist — verify state isolation, approvals, recovery, and observability before rollout.