Skip to content

nf synth

Export Terraform JSON from apps registered for legacy compatibility. Use this command when an existing Terraform/OpenTofu pipeline needs generated configuration.

Synopsis

nf synth [APP_NAMES]... [OPTIONS]

What It Reads

nf synth reads app definitions from [tool.nf].legacy_apps in pyproject.toml.

Example:

[tool.nf]
python = ["uv", "run", "python"]
legacy_apps = ["app:app"]

Each entry is a module:object import spec. The object can be:

  • an App instance
  • a callable that returns one App
  • a callable that returns multiple App objects

Main Modes

Synthesize All Configured Legacy Apps

nf synth

Synthesize Specific App Selectors

nf synth app
nf synth network:app

Selectors come from [tool.nf].legacy_apps after the CLI resolves them into short names.

Synthesize Apps And Run Example Scripts

nf synth --all

--all includes configured example_scripts from [tool.nf] in addition to legacy apps.

Options

  • --no-auto-naming: disable automatic construct ID injection
  • --all: synthesize configured apps and run example scripts from [tool.nf]
  • --phased/--no-phased: enable phased execution output for circular dependencies

Output And Inventory Behavior

nf synth writes synthesized output to the CLI inventory outdir. The default is usually .nf.out/, but effective lookup can also be influenced by:

  • [tool.nf.config].outdir (where app.synth(...) writes)
  • [tool.nf].outdir
  • command-level --outdir on commands that consume synthesized stacks later

Typical layout:

.nf.out/
  my-app/
    network/
      nf.tf.json
      plan.sh
      apply.sh
      destroy.sh

The first directory level is the synthesized app. The next level is the stack.

Important Behavior

  • nf synth is only for legacy apps configured in [tool.nf].legacy_apps
  • hybrid apps are planned and applied through app-level hybrid commands instead
  • if app selectors are ambiguous, the CLI expands them to more specific names
  • synthesized stack inventory is what later stack-oriented commands discover

Examples

nf synth
nf synth app
nf synth --no-auto-naming
nf synth --phased
nf synth --all