Skip to content

nf deploy

Plan and apply a configured app in one command. Use nf plan --out and nf apply --plan-file when you want to retain and apply a separately reviewed plan.

Synopsis

nf deploy [OPTIONS]

Two Deployment Modes

App-Scoped Direct Deploy

For apps selected with --app, nf deploy can plan and apply through the direct execution engine at app scope.

Typical use:

nf deploy --app platform

This direct path is available for:

  • apps from [tool.nf].hybrid_apps
  • selected apps from [tool.nf].legacy_apps

Configured apps can also deploy a single stack directly with --app <selector> --stack <stack> or an unambiguous --stack app/stack selector. That direct path remains valid even when synthesis would emit phased export artifacts for circular dependencies; phased bundles are now the distributable Terraform/OpenTofu handoff format, not the local runtime mechanism.

If a project contains only hybrid apps, nf deploy can run over all of them in configuration order without an explicit app selector.

Legacy Stack Deploy

Select an explicit synthesized directory to use the external lifecycle.

nf deploy --stack .nf.out/platform/network --skip-synth

--skip-synth reuses the existing export. Legacy deploy can also run synthesis, external initialization, and external apply. See the compatibility workflow.

Options

  • --stack, -s TEXT: configured app/stack or synthesized legacy stack selector
  • --app TEXT: app selector
  • --outdir PATH: synthesis output directory override
  • --auto-approve: skip interactive approval
  • --no-auto-naming: disable automatic construct ID injection during synthesis
  • --skip-synth: reuse existing synthesized output for legacy-path deploys
  • --recovery-strategy checkpoint|rollback|none: what a failed direct deploy does (default checkpoint)
  • --run-status/--no-run-status: keep the run's live status beside its state for nf follow (default on)

Direct execution controls

These controls apply to configured hybrid apps and directly executed legacy apps:

Option Behavior
--parallelism N Concurrent resource mutations; default 10 (nf --max-concurrent-resources for every command)
--read-parallelism N Concurrent refresh/plan calls and independent provider startup; default 40 (nf --max-concurrent-reads)
--refresh=false Plan using stored values without refreshing managed objects; default true
--target ADDRESS Select a full state address, such as platform.aws_vpc.main, plus its dependencies; repeatable
--plan-scope changed Inspect edited configurations and their dependency closure; full drift inspection is the default
--quiet Hide per-resource progress; keep the final result summary
--graph-plan-scope full\|affected Graph planning qualification policy; affected requires a retained baseline
--baseline FILE Retained graph branch origin (uses nf.baseline when present)
--prefer-mine ADDRESS Resolve a graph intent conflict using this branch's configuration; repeatable
--provenance-report Report observed reads, writes and estimated lease requirements

Changed scope and targets leave unrelated drift uninspected. Unknown evaluation effects make changed scope fall back to full configuration inspection. Existing rows without configuration fingerprints are inspected once. Saved plans preserve their scope; scope flags cannot alter --plan-file. --graph-plan-scope affected cannot be combined with these targets, changed scope or refresh=false. Stack selection uses --stack app/stack or --app app --stack stack.

Raw Terraform/OpenTofu arguments and --legacy-bin are rejected for hybrid apps. Synthesized legacy stacks retain their subprocess passthrough path.

Additional apply controls:

Option Default and behavior
--apply-deferred Off; allow saved/auto-approved plans to plan and apply deferred changes
--deferred-approval once\|each_round\|auto\|always once; initial approval covers deferred work. auto requires --apply-deferred
--incomplete-exit-code N 2 when an otherwise successful apply leaves deferred changes
--provider-data-sources read\|state read; refresh provider-setting data sources before configuration
--deleted-objects review\|recreate\|error review; recreating externally deleted objects requires review
--concurrent-applies / --no-concurrent-applies Off; opt into graph resource grants with a retained baseline

See deferred provider configuration and graph state for approval and recovery behavior.

Important Behavior

  • --stack selects a configured app stack or a legacy synthesized stack
  • --app is how you explicitly select app-scoped direct execution for deploy
  • configured apps also support stack-scoped direct deploys
  • for direct deploys, --skip-synth is ignored because synthesized Terraform output is not the runtime artifact
  • explicit filesystem stack paths and synthesized stack selectors stay on the legacy subprocess path
  • stack directories that only contain legacy phased Terraform artifacts are rejected on the --stack path; use --app direct execution instead

Interrupting

Ctrl-C works as it does for Terraform:

  • before anything changes (planning, the approval prompt) it aborts the command
  • once a direct deploy changes infrastructure, the first Ctrl-C stops it cleanly: resources being applied finish and are recorded in state, nothing else starts, and the command exits 1 saying it stopped. The app's recovery_strategy applies as for any failed deploy (see Stop an apply in progress)
  • a second Ctrl-C stops without waiting: changes in flight may not be recorded in state, so check them before the next apply (nf state recover for graph state). A third exits at once
  • on the legacy --stack path, Terraform/OpenTofu handles Ctrl-C itself (graceful, then immediate) and nf waits for it; a third Ctrl-C kills it

Examples

nf deploy
nf deploy --stack network
nf deploy --stack platform/network
nf deploy --app platform
nf deploy --stack network --skip-synth
nf deploy --stack network --auto-approve

When To Prefer Other Commands

Use:

  • nf synth when you only want generated artifacts
  • nf plan when you want to inspect changes before applying
  • nf apply when you already know you want a direct apply step without the combined deploy workflow