Skip to content

Examples Catalogue

Every directory under examples/ is a self-contained, runnable hybrid app with its own pyproject.toml and README.md. All 25 examples are built and verified continuously by tools/docs/tests/test_examples.py.

The first 15 examples require no cloud account and are registered in the repository's root pyproject.toml, so nf list apps and nf tui from the repo root open them directly.


Local examples (no cloud account required)

Run these locally using built-in GeneratedValue or the hashicorp/random, hashicorp/null, and hashicorp/external providers:

Example Demonstrates Companion docs
examples/rollback_on_failure recovery_strategy="ROLLBACK" deleting newly created resources after a @hybrid_runtime failure Tutorial 3 · Rollback and recovery
examples/environments Typed ++ inputs, per-environment stacks, Python loops, recorded destroy inputs, LifecycleRules(retain=...), Teardown[bool] Tutorial 2 · nf vars
examples/audited_runs app.check(phase="finalize") writing SHA-256 evidence and nf state verify after a kill -9 Tutorial 3 · App checks
examples/guardrails App checks at prerequisites, plan, and apply phases using Teardown[str] change tickets App checks
examples/no_destroy_guard An apply-phase guard that blocks any deploy attempting to delete or replace a resource App checks
examples/blast_radius_gate Policy-as-Python blast-radius cap failing under the lock if >25% of managed resources change App checks
examples/maintenance_window Production deploy freeze enforced in Python with Teardown[str] break-glass override and SHA-256 audit trail App checks
examples/cidr_ipam Real-Python IPAM & CIDR subnet allocation via ipaddress.IPv4Network with fast overflow errors Configuration model
examples/post_apply_smoke_test @post_apply_check validating live resource attributes and rolling back automatically on failure Runtime functions & checks
examples/canary_rollout Multi-stage canary → Python health check → prod promotion (or automatic canary teardown) via nf.sdk nf.sdk API Reference
examples/generated_secrets Built-in GeneratedValue password + TLS CA + signed cert (write-only CA key, zero external providers) + Secret[str] Generated values
examples/circular_references Mutual resource references broken automatically with enable_circular_dep_resolution=True Dependencies and phases
examples/pluggable_storage Pluggable local / aws / gcp backend via Python match cloud: with zero count = 0 hacks Providers
examples/local_tools External data source invoking a local script; Null resource replaced when output changes Providers and runtime values
examples/python_api Every command as a Python call: plan, refuse deletes, apply the reviewed plan, read outputs nf.sdk API Reference

Cloud and service examples

Example Demonstrates Requires Companion docs
examples/aws_multi_region Dynamic for region in regions: fan-out creating one AwsProvider, stack, and bucket per region AWS Providers
examples/aws_adopt_default_sg Creating a VPC and adopting its auto-created default security group in the same apply (import_from runtime ID) AWS Adopting infrastructure
examples/aws_release_upload Automatic ROLLBACK removing an S3 bucket when release manifest upload fails AWS Why Netherframe
examples/aws_order_history Retaining a DynamoDB table (managed & checked via @retained_check) through nf destroy AWS nf destroy
examples/aws_eks_platform Creating an EKS cluster and Kubernetes namespaces in one apply via deferred provider config AWS Deferred providers
examples/aws_team_parameters Multiple teams applying disjoint SSM changes concurrently on PostgreSQL graph state AWS, PostgreSQL Graph state backend
examples/aws_adopt_existing Importing an existing S3 bucket into state through a reviewed adoption plan AWS Adopting infrastructure
examples/gcp_cloud_run Cloud Run v2 service and GCS bucket with Python conditional resource composition Google Cloud Why Netherframe
examples/azure_storage Storage account and containers protected by prevent_destroy Azure nf destroy
examples/keycloak_realm Realm, clients, roles, same-apply adoption of built-in scopes, and Secret[str] input Keycloak Codifying a Keycloak realm

Earlier legacy demos

examples/legacy/ retains earlier scripts illustrating Terraform JSON synthesis (nf synth), BackendChain bootstrapping, discovery, and phased circular-dependency exports. Start with the hybrid examples above for new projects.