Tutorial 1: Run your first hybrid app
In this tutorial you will create a small Netherframe app, save and inspect an execution plan, apply it directly through a Terraform provider binary, verify convergence, and tear it down.
You will use the hashicorp/random provider, which runs locally and requires no cloud
account, no credentials, and no Terraform or OpenTofu installation.
What you need: Python 3.15 or later and nf installed. If you have not installed
Netherframe yet, follow Install Netherframe first.
The first provider download needs network access unless the binary is already cached.
Step 1: Create a project and install Random bindings
Create a fresh directory, initialize a project, and generate typed Python bindings for
hashicorp/random:
mkdir nf-first-app && cd nf-first-app
uv init --python 3.15
uv add netherframe.cli
source .venv/bin/activate
nf generate providers hashicorp/random --version 3.9.1 --yes
uv add --editable ./providers/hashicorp/random
mkdir nf-first-app && cd nf-first-app
python3.15 -m venv .venv
source .venv/bin/activate
python -m pip install netherframe.cli
nf generate providers hashicorp/random --version 3.9.1 --yes
python -m pip install -e ./providers/hashicorp/random
From the root of your prepared checkout, activate .venv, generate and install the
Random bindings, then move into a separate directory for this tutorial:
source .venv/bin/activate
nf generate providers hashicorp/random --version 3.9.1 --yes
uv run poe providers-install
mkdir ../nf-first-app && cd ../nf-first-app
When this finishes, nf.providers.hashicorp.random is importable from Python and the
provider binary is ready for nf to launch.
Step 2: Define the app
Create app.py in your project directory:
# coding: nf_autoid
from nf.core import App, Bind, BindContext, Output, Stack
from nf.providers.hashicorp.random import Pet, RandomProvider
with App(nf_id="hybrid-demo") as app, Stack() as names, BindContext:
random: Bind[RandomProvider] = RandomProvider()
example: Bind[Pet] = Pet(nf_provider=random, length=2)
pet_name: Bind = Output(value=example.output.id)
app.enable_hybrid_execution_local(path=".nf.out/hybrid.tfstate")
Next, register the app in pyproject.toml (add this table to the file uv init created,
or create pyproject.toml if you started from a source checkout):
[tool.nf]
apps = ["app:app"]
Confirm that nf discovers your app:
nf list apps
You should see app listed with spec app:app.
Step 3: Save and inspect a plan
Generate a plan and save it to reviewed-plan.json:
nf plan --app app --out reviewed-plan.json
You will see a create planned for names.random_pet.example:
Planning app · local .nf.out/hybrid.tfstate
Type Name Plan Info
nf:app app
└─ nf:stack names
+ └─ random_pet example create
Resources:
+ 1 to create
Inspect the saved plan file to verify what is stored in it:
nf show --plan-file reviewed-plan.json
Notice that the generated name is shown as (known after apply) because the provider has
not created the object yet.
Step 4: Apply the saved plan
Apply the exact plan you just reviewed:
nf apply --app app --plan-file reviewed-plan.json
At the confirmation prompt, type details if you want to inspect every attribute, then
type yes to apply.
Netherframe starts the hashicorp/random binary over gRPC, creates names.random_pet.example,
writes state to .nf.out/hybrid.tfstate, and prints the pet_name output (for example,
calm-otter).
Step 5: Verify convergence
Run nf plan again without editing app.py:
nf plan --app app
Netherframe refreshes names.random_pet.example from .nf.out/hybrid.tfstate and reports
no changes—the generated name is stable across runs.
Step 6: Make a change and observe replacement
Edit app.py to change length=2 to length=3, then run:
nf plan --app app --diff
Because changing length on random_pet forces replacement, the plan shows ± replace
with ~ length = 2 → 3 # forces replacement. Apply it with nf apply --app app and
approve with yes to see a new three-word name in Outputs:.
Step 7: Destroy the resources
Clean up when you are finished:
nf destroy --app app
Review the delete plan and type yes. Netherframe removes names.random_pet.example and
its output from .nf.out/hybrid.tfstate.
What you just learned
- How
App,Stack,Provider,Resource, andOutputfit together in Python withnf_autoid. - How
[tool.nf].appsregisters an app fornf. - How to save an immutable whole-app plan (
--out), inspect it (nf show), apply it (--plan-file), verify convergence, and destroy it.
Next steps
- Continue the learning track: Tutorial 2: Inputs, stacks, and safe teardown.
- Understand the concepts: Read Apps, stacks, resources, and providers and Backends and state.
- Try a real cloud: Follow the AWS quickstart tracks.