Skip to content

Plan, apply and destroy

Use hybrid execution for new Netherframe projects. Planning compares the app with state and provider observations. Apply carries out a reviewed plan, and destroy removes managed objects. Run nf from the project directory with its Python environment active. Try the sequence in your first hybrid app.

Run a configured app directly

For a hybrid app registered as app:app:

nf plan --app app --out reviewed-plan.json
nf show --plan-file reviewed-plan.json
nf apply --app app --plan-file reviewed-plan.json
nf plan --app app

Review the saved whole-app plan, approve apply and check the next plan for convergence. The same state backend and provider settings must be available when applying. If the saved plan is stale, create and review another plan. See CI/CD.

When you need to target one stack in a configured app, select it explicitly.

nf plan --app app --stack names
nf apply --app app --stack names

These examples select the names stack in app. The stack apply plans again and prompts for approval. Use app scope when you need to save and apply a reviewed plan file. See plan modes for the full selector rules.

Legacy compatibility

For a pipeline that consumes Terraform configuration, register the app in [tool.nf].legacy_apps and export with nf synth:

nf synth
nf list stacks

Inspect .nf.out/<app>/<stack>/nf.tf.json. Both commands run without changing cloud resources. See output files for the other generated artifacts.

Hand the files to Terraform or OpenTofu

The external CLI provides the basic lifecycle and manages its own state. For example, after synthesizing app hello-nf, stack storage:

terraform -chdir=.nf.out/hello-nf/storage init
terraform -chdir=.nf.out/hello-nf/storage plan
terraform -chdir=.nf.out/hello-nf/storage apply

Use your configured OpenTofu binary instead if that is the engine you operate. This path needs that executable, provider access and the appropriate credentials. Its backend is configured in the synthesized Terraform configuration.

The nf CLI can also select this boundary explicitly:

nf plan --stack .nf.out/hello-nf/storage

Do not switch from this state to a direct nf backend by merely changing a selector. Use adoption to establish the new state mapping.

Destroy when the resource group is no longer needed

Use the same execution boundary and backend that managed the apply:

# Direct app execution
nf destroy --app app

# External Terraform execution
terraform -chdir=.nf.out/hello-nf/storage destroy

Review the destruction plan. With real cloud resources, provider configuration, data retention requirements and lifecycle rules determine what can be removed.

Understand partial progress

An apply can change some objects before another operation fails. A failed command does not imply that infrastructure is unchanged. Inspect its recovery notes and stored state, correct the cause and review a fresh plan. The recovery runbook explains CHECKPOINT, ROLLBACK and NONE, including the limits of restoring a checkpoint.