Skip to main content

tf-project

PyPI License

tf-project (tfp for short) is a small, opinionated wrapper around Terraform and OpenTofu for projects with one tfvars file per environment.

You keep dev.tfvars, staging.tfvars and prod.tfvars side by side. Plain Terraform makes you re-run terraform init with the right backend settings every time you switch between them, and remember which one you're on. With tfp you switch with tfp use prod, and tfp plan / tfp apply act on that environment until you switch again.

What you get:

  • Instant switching. Each environment (a slot) keeps its own .terraform/ directory, so switching back to one you've used is just a pointer change, with no re-init.
  • Safer applies. tfp apply only applies the plan you just reviewed, and refuses if the tfvars, the .tf sources or the backend changed since.
  • Protected environments. Mark prod as protected and every command that changes it asks you to type its name first, after showing what the plan destroys or replaces.
  • A safety net for state surgery. tfp state rm, mv and import snapshot the remote state first, and tfp self snapshot restore puts it back.
  • Secrets out of git. Tfvars can hold references like {{ op://Infra/db/password }} or {{ az-kv://my-vault/secrets/db-password }}; tfp fills them in from 1Password or Azure Key Vault at run time.
  • Drift checks. tfp drift plans every environment and reports which ones no longer match their code.
  • Help when things go wrong. tfp self doctor checks your setup, and tfp self lock break clears a stuck Azure or S3 state lock.

Install

brew install release-art/tap/tf-project   # macOS, Linux
pip install tf-project                     # or: uv tool install tf-project

On Windows, with Scoop:

scoop bucket add release-art https://github.com/release-art/scoop-bucket
scoop install release-art/tf-project

You get one native program under two names, tfp and tf-project, for macOS, Linux and Windows; pip only delivers it, no Python is needed to run it. GitHub releases also have plain .tar.gz / .zip downloads.

A five-minute tour

Say your repository looks like this:

terraform/
  api/            main.tf, variables.tf, …
tfvars/
  dev.tfvars
  prod.tfvars

1. Create a config at the repository root:

tfp self init

This writes a tf_project.toml with sensible defaults (or adds a [tool.tf_project] section to an existing pyproject.toml).

2. Tell each tfvars file which project it belongs to, with a one-line JSON comment at the top, the banner:

# {"header": "terraform", "project": "api"}
instance_count = 2

The slot is named after the file: tfvars/dev.tfvars becomes slot dev.

3. Switch to an environment and work in it:

tfp use dev       # first time: runs terraform init for this slot
tfp plan          # plans against dev, saves the plan
tfp apply         # applies exactly that plan
tfp use prod      # switch; dev stays initialised for next time
tfp status        # which slot am I on?

If anything looks off, tfp self doctor checks your setup.

Everyday commands

Command What it does
tfp use <slot> Switch to a slot (by name, or by tfvars path).
tfp ls List slots; the active one is marked *.
tfp status Show the active slot and whether a plan is waiting.
tfp plan / tfp apply Plan and save; apply the saved plan. -t <address> targets.
tfp state … / tfp import … Terraform's state commands, with a snapshot first.
tfp drift Plan every slot without saving, and report which ones drifted.
tfp tf <anything> Any other Terraform command, run in the active slot.
tfp -s prod plan Run one command against another slot without switching.
tfp --dry-run … Show the Terraform command line instead of running it.

Learn more

  • Configuration: tf_project.toml, the tfvars banner, slot names, backend settings and the provider cache.
  • Commands: every command and flag, and how tfp picks the active slot.
  • Secrets: 1Password and Azure Key Vault references in tfvars.
  • Safety and recovery: stale-plan checks, protected slots, state snapshots, the Azure sign-in check and stuck locks.
  • Development: building, testing and releasing tf-project itself.
  • Changelog

License

MIT

Metadata

Release files for tf-project 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tf-project 0.4.0
File Size Uploaded Provenance Actions
tf_project-0.4.0.tar.gz 104.1 kB With provenance Details for tf_project-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tf-project 0.4.0
File Actions
tf_project-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for tf_project-0.4.0-py3-none-win_amd64.whl
tf_project-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for tf_project-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
tf_project-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for tf_project-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
tf_project-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for tf_project-0.4.0-py3-none-macosx_11_0_arm64.whl
tf_project-0.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for tf_project-0.4.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 30.9 MB

Release files / tf_project-0.4.0.tar.gz

Download URL tf_project-0.4.0.tar.gz
Size 104.1 kB
Tags Source
SHA-256 checksum
How to use checksums
54d5e0f371d45bf05d72a1007cb82c7fe7ee8d22f45362dff8d3c9d33977b935
BLAKE2b-256 checksum
How to use checksums
9ed5602582ef0e832bc65429602f928a7676690de7c011f7b452302020e02853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tf_project-0.4.0-py3-none-win_amd64.whl

Download URL tf_project-0.4.0-py3-none-win_amd64.whl
Size 6.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
4b8fb7e01eb8329afcfefce61657be19f6ad1142c549cebf3909a88051bb73d8
BLAKE2b-256 checksum
How to use checksums
4e0fd99879798aa37b74df30fe763a5fd26dc293b8ed633e1e68c5dff1ecbf29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tf_project-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL tf_project-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 6.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
6240fb98d2a708e2928b8bfa3be9b92fa8ed05802a80ad3f055ab0e892337617
BLAKE2b-256 checksum
How to use checksums
8de91b9557f1b40487128e75dd6ae05223c15800a52f8e1f6beb519a7d18f897
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tf_project-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL tf_project-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1737023034ad2e69570ff0884aeb7dda9f763258d3e2be1ebb2ce6dc55689110
BLAKE2b-256 checksum
How to use checksums
8f4e006209ac51d058d9793dbc396f9ea6923a5a922c28d4011fa92abac255fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tf_project-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL tf_project-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 5.9 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
87ed136477a6636bf44e1b14dd2f61f3a162ba07e77a4a861e66be4b582bd6e6
BLAKE2b-256 checksum
How to use checksums
0a55189c2d2a4e43ef424beb261869c91692fb82e3f3b1452b30267a511f1a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tf_project-0.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL tf_project-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 6.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c50ca7cae657b64951320f81febc705d6135a3b1eef669384e3a8249713c15ea
BLAKE2b-256 checksum
How to use checksums
da436749b742b2bdfd2d476aee530e5bfedb6fbd0e3aa67c38dc304e6cd1d8ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for tf-project 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for tf_project-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page