Why Netherframe
Netherframe runs the same provider binaries Terraform runs, so it can manage everything the Terraform ecosystem manages. What sets it apart is what happens around a run: a failed apply that cleans up after itself, a teardown that keeps critical data managed and verified, runs that a crash cannot leave unverified, and teams that apply disjoint changes to one app at the same time.
Each section below examines a real operational failure mode, what other tools leave you with, and how Netherframe handles it. Comparisons reflect Terraform, OpenTofu, and Pulumi as of November 2026.
| Operational need | Netherframe | Terraform and OpenTofu | Pulumi |
|---|---|---|---|
| Clean up newly created resources after a failed apply | recovery_strategy="ROLLBACK", for any provider |
Partial changes remain | Partial changes remain |
Keep specific resources through destroy, still managed and verified |
LifecycleRules(retain="why") + @retained_check |
removed { destroy = false } stops managing them |
retainOnDelete stops managing them |
| Teardown-only flag verified not to alter deployed shape | Teardown[bool] inputs, verified automatically |
None | None |
Post-run checks with audit evidence, resumable after kill -9 |
Finalizers (phase="finalize") + nf state verify |
check blocks warn at end of run only |
Interrupted operations flagged on next update |
| Concurrent applies to one shared app | PostgreSQL graph state for provably disjoint changes | One run holds the state lock | One update per stack |
| Provider configured from resources created in the same apply | Single apply with deferred rounds | Experimental (alpha builds) | Single update |
AWS CloudFormation also rolls back a failed stack, limited to AWS resources.
A failed apply cleans up after itself
Consider a release upload that creates an S3 bucket and then writes a manifest extracted
from a release ZIP. If the ZIP is missing release.json, step two fails after step one
already created the bucket. Terraform, OpenTofu, and Pulumi stop there: the bucket remains
behind and the next run starts from a half-built release.
With recovery_strategy="ROLLBACK", Netherframe deletes what the failed apply created:
# coding: nf_autoid
import json
from zipfile import ZipFile
from nf.core import App, Bind, BindContext, Stack
from nf.core.runtime.runtime import hybrid_runtime
from nf.providers.hashicorp.aws import AwsProvider, S3Bucket, S3Object
@hybrid_runtime
def release_manifest(bucket: str, artifact: str) -> str:
# Runs during apply once the bucket exists and its name is known
with ZipFile(artifact) as archive:
release = json.loads(archive.read("release.json"))
return json.dumps({"bucket": bucket, "release": release})
def app(artifact: str = "dist/release.zip", region: str = "us-east-1") -> App:
with App(recovery_strategy="ROLLBACK") as app, Stack() as release, BindContext:
aws: Bind = AwsProvider(region=region)
bucket: Bind = S3Bucket(bucket_prefix="releases-")
manifest: Bind = S3Object(
bucket=bucket.output.id,
key="release.json",
content=release_manifest(bucket.output.id, artifact),
content_type="application/json",
)
return app
release_manifest is ordinary Python executed during apply with resolved values. Given an
archive missing release.json, the apply fails and immediately removes the bucket it made:
$ nf apply --app app ++artifact=build/broken.zip
+ release.aws_s3_bucket.bucket: creating
+ release.aws_s3_bucket.bucket: created (1.9s)
+ release.aws_s3_object.manifest: creating
+ release.aws_s3_object.manifest: create failed (0.0s): "There is no item named 'release.json' in the archive"
- release.aws_s3_bucket.bucket: deleting
- release.aws_s3_bucket.bucket: deleted (0.6s)
Diagnostics:
release.aws_s3_object.manifest:
error: "There is no item named 'release.json' in the archive"
note: Rolled back 1 resources created by this apply.
Rollback deletes resources created by the failing apply and explicitly reports any
completed updates or deletions it cannot invert. The default strategy, CHECKPOINT,
preserves partial progress and retains a pre-apply state checkpoint.
Try it locally without AWS in Tutorial 3
or examples/rollback_on_failure. See Rollback and recovery.
Keep the data, delete the rest, and verify what was kept
Tearing down an environment should delete transient queues and topics while keeping the
order-history table—still managed, still recoverable. Terraform's prevent_destroy fails
the entire destroy; removed { destroy = false } and Pulumi's retainOnDelete eject the
resource from state and never check it again.
In Netherframe, a retained resource stays in state with its reason. A destroy keeps the
resource and what protects it, reads each kept object back from its provider, and runs its
@retained_check validators:
# coding: nf_autoid
from nf.core import App, Bind, BindContext, LifecycleRules, Output, Stack, Teardown
from nf.core.runtime import RuntimeCheckContext, retained_check
from nf.providers.hashicorp.aws import AwsProvider, DynamodbTable, SnsTopic, SqsQueue
@retained_check("point-in-time recovery stays on for the kept order history")
def recoverable(context: RuntimeCheckContext) -> bool:
recovery = (context.current_state or {}).get("point_in_time_recovery") or []
return any(item.get("enabled") for item in recovery)
def orders(env: str = "dev", region: str = "eu-west-1", keep_orders: Teardown[bool] = False) -> App:
with App(nf_id="orders") as app, Stack(nf_id=f"orders-{env}") as orders, BindContext:
aws: Bind = AwsProvider(region=region, default_tags=[{"tags": {"app": "orders", "env": env}}])
table: Bind = DynamodbTable(
name=f"orders-{env}",
billing_mode="PAY_PER_REQUEST",
hash_key="order_id",
attribute=[{"name": "order_id", "type": "S"}],
point_in_time_recovery=[{"enabled": True}],
lifecycle=LifecycleRules(retain="order history outlives the environment") if keep_orders else None,
runtime_checks=[recoverable()],
)
events: Bind = SqsQueue(name=f"orders-{env}-events")
alerts: Bind = SnsTopic(name=f"orders-{env}-alerts")
table_name: Bind = Output(value=table.output.name)
return app
env is a deployment input recorded in state on apply; keep_orders is a Teardown[bool]
input allowed only to toggle lifecycle retention:
$ nf destroy --app orders ++env=dev
Error: orders: the last apply was made with env=prod, not dev (++env)
$ nf destroy --app orders ++keep_orders
Destroying orders · local .nf.out/nf.tfstate
with env=prod region=eu-west-1 keep_orders=true
- orders-prod.aws_sqs_queue.events: deleting
- orders-prod.aws_sns_topic.alerts: deleting
- orders-prod.aws_sns_topic.alerts: deleted (0.5s)
- orders-prod.aws_sqs_queue.events: deleted (0.7s)
Resources:
- 2 deleted
1 unchanged
Kept 1 retained resource (lifecycle retain): orders-prod.aws_dynamodb_table.table (order
history outlives the environment)
Three engine invariants keep these guarantees airtight:
- Dependency protection: Everything a retained resource depends on—and everything that
depends on it (such as bucket encryption or a public access block)—must also be retained
unless it explicitly declares
retain=False. Otherwisenf destroyrefuses before approval and names every offending resource. - Verified shape: Netherframe rebuilds the app with
Teardowninputs at their defaults and compares the deployment shape so a teardown switch can never secretly alter resources. - Durable rule: The retention rule is persisted in state, so even removing the resource from Python code cannot silently delete it.
Try it locally without AWS in Tutorial 2 or
examples/environments (AWS version: examples/aws_order_history).
Know what a run left, even after a crash
When compliance or operations requires an audit record of every run, Terraform's check
blocks only emit end-of-run warnings, and Pulumi only flags interrupted operations on the
next update. Neither re-runs your verification logic over an interrupted run's exact
planned scope nor records cryptographic evidence references.
A finalizer (app.check(..., phase="finalize")) runs under the state lock after every
apply and destroy regardless of outcome:
# coding: nf_autoid
import hashlib
import json
from pathlib import Path
from nf.core import App, AppCheckContext, Bind, BindContext, Evidence, Finalized, Stack
from nf.providers.hashicorp.google import CloudRunV2Service, GoogleProvider, StorageBucket
def inventory(ctx: AppCheckContext) -> Finalized:
run = ctx.run
record = {
"run": run.run_id,
"attempt": run.attempt,
"operation": run.operation,
"changes": {item.address: item.status for item in run.resources},
"before": {address: prior.get("id") for address, prior in run.prior.items()},
"kept": dict(run.retained),
"owned": sorted(ctx.state),
}
body = json.dumps(record, sort_keys=True).encode()
path = Path("audit") / f"{run.run_id}-{run.attempt}.json" # in practice, a bucket or database
path.parent.mkdir(exist_ok=True)
path.write_bytes(body)
problems = tuple(f"{item.address} {item.status}: {item.error}" for item in run.of("failed", "unknown"))
return Finalized(
problems=problems,
evidence=(Evidence("inventory", path.resolve().as_uri(), hashlib.sha256(body).hexdigest()),),
)
def web(project: str, region: str = "europe-west1") -> App:
with App(nf_id="web") as app, Stack() as web, BindContext:
google: Bind = GoogleProvider(project=project, region=region)
uploads: Bind = StorageBucket(name=f"{project}-uploads", location="EU", uniform_bucket_level_access=True)
service: Bind = CloudRunV2Service(
name="web",
location=region,
template=[
{
"containers": [
{
"image": "us-docker.pkg.dev/cloudrun/container/hello",
"env": [{"name": "UPLOADS", "value": uploads.output.name}],
}
]
}
],
)
app.check(inventory, phase="finalize")
return app
Before its first mutation, Netherframe writes a durable run record beside state. If the
process is killed with kill -9 or a CI worker vanishes, the record remains running
until someone inspects and verifies it:
$ nf state runs --app web
running 20261120T200916.453807985Z-d60d5236 apply started 2026-11-20 20:09:16Z,
0 attempts, 0 evidence
$ nf state verify --app web
Finalizer app.inventory: web.google_storage_bucket.uploads unknown
Finalizer app.inventory: web.google_cloud_run_v2_service.service unknown
Unrecorded changes are reported honestly as unknown rather than guessed. Try it locally
(including kill -9) in examples/audited_runs, or see App checks and finalizers.
Several teams, one app, applying at once
In Terraform and Pulumi, one writer locks the entire state document—forcing unrelated team changes to serialize or pushing organizations to shatter one platform into dozens of tiny states.
With Netherframe's PostgreSQL graph state backend,
state is stored as versioned rows and fenced operations. With --concurrent-applies and a
retained baseline, runs whose changes are provably disjoint acquire fine-grained resource
grants instead of an app-wide lock:
# coding: nf_autoid
from nf.backends.postgresql import PostgreSQLGraphBackend
from nf.core import App, Bind, BindContext, Stack
from nf.providers.hashicorp.aws import AwsProvider, SsmParameter
TEAMS = {
"payments": {"timeout_ms": "2500", "retries": "3"},
"search": {"replicas": "4", "index": "products-v7"},
}
def parameters(db_host: str = "localhost", region: str = "eu-west-1") -> App:
app = App(nf_id="parameters", baseline="nf.baseline", concurrent_applies=True)
with app:
for team, settings in TEAMS.items():
with Stack(nf_id=team), BindContext:
aws: Bind = AwsProvider(region=region)
for key, value in settings.items():
SsmParameter(nf_id=key, nf_provider=aws, name=f"/{team}/{key}", type_="String", value=value)
# The password comes from a file (--postgresql-password-file), never from code or a flag
app.enable_hybrid_execution(state_backend=PostgreSQLGraphBackend(state_id="parameters", host=db_host, database="netherframe", username="nf_apply"))
return app
Where Netherframe cannot prove two runs are disjoint (for example, an unqualified resource
identity contract), it falls back to an app-wide grant automatically—never trading safety
for concurrency. See examples/aws_team_parameters.
A cluster and what runs on it, in one apply
Creating an EKS cluster and Kubernetes namespaces inside it requires configuring the Kubernetes provider from values that do not exist until the cluster is created:
# coding: nf_autoid
import base64
from nf.core import App, Bind, BindContext, Provider, Resource, Stack
from nf.core.runtime.runtime import hybrid_runtime
from nf.providers.hashicorp.aws import AwsProvider, EksCluster
@hybrid_runtime
def certificate(authority: list[dict[str, str]]) -> str:
return base64.b64decode(authority[0]["data"]).decode()
def platform(
cluster_role_arn: str,
subnet_ids: list[str],
name: str = "platform",
teams: tuple[str, ...] = ("payments", "search"),
) -> App:
with App(nf_id="platform") as app, Stack() as platform, BindContext:
aws: Bind = AwsProvider(region="us-east-1")
cluster: Bind = EksCluster(name=name, role_arn=cluster_role_arn, vpc_config=[{"subnet_ids": subnet_ids}])
kubernetes: Bind = Provider(
nf_type="kubernetes",
host=cluster.output.endpoint,
cluster_ca_certificate=certificate(cluster.output.certificate_authority),
exec=[
{
"api_version": "client.authentication.k8s.io/v1beta1",
"command": "aws",
"args": ["eks", "get-token", "--cluster-name", name],
}
],
)
for team in teams:
Resource(nf_type="kubernetes_namespace", nf_id=f"team-{team}", nf_provider=kubernetes, metadata=[{"name": team}])
return app
The initial plan defers the namespaces because kubernetes waits on the cluster endpoint;
nf apply creates the cluster, configures the Kubernetes provider from it, and then plans
and applies the deferred round in the same run. See
Deferred provider configuration
and examples/aws_eks_platform.
Everyday ergonomics that add up
- Interactive terminal UI (
nf tui): Browse apps, stacks, state, attribute diffs, dependency graphs (:graph), live runs, and record/replay sessions. - Terminal progress integration: Runs emit OSC 7501 (Rex) or OSC 9;4 (Ghostty, Windows Terminal, ConEmu) so unfocused tabs show when a run is working, waiting for approval, or finished.
- First-party Python SDK (
nf.sdk): Everynfcommand is a typed Python method onProjectandAsyncProject, returning structured dataclasses and raisingNfError. - No environment-variable surprises: Neither settings nor app inputs are silently read
from
NF_*environment variables, andSecret[T]inputs are never accepted on the command line. - Tamper-evident saved plans: Saved plans embed SHA-256 content digests, state fingerprints, input digests, and declared app checks so apply executes exactly what was reviewed.
Browse all 25 runnable examples in the Examples catalogue.