Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.
  • 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/db-password }}; tfp fills them in from 1Password or Azure Key Vault at run time.
  • 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

pip install tf-project        # or: uv tool install tf-project

That installs two names for the same program: tf-project and tfp. It's a single native executable for Linux (x86_64, arm64), macOS (Apple Silicon) and Windows (x86_64); Python is only the delivery vehicle. Prefer no Python? Each GitHub release also has the programs as a plain .tar.gz / .zip.

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?

Run tfp self doctor at any point to check that Terraform, your secret tools and the directories are where tfp expects them.

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 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, and how slots get their names and backend settings.
  • Commands: every command and flag, and how tfp picks the active slot.
  • Secrets: 1Password and Azure Key Vault references in tfvars.
  • Safety and recovery: how applies are guarded, state snapshots, stuck locks, and the provider cache.
  • Development: building, testing and releasing tf-project itself.
  • Changelog

License

MIT

Metadata

Release files for tf-project 0.3.1rc1

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.3.1rc1
File Size Uploaded Provenance Actions
tf_project-0.3.1rc1.tar.gz 89.1 kB With provenance Details for tf_project-0.3.1rc1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tf-project 0.3.1rc1
File Actions
tf_project-0.3.1rc1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for tf_project-0.3.1rc1-py3-none-win_amd64.whl
tf_project-0.3.1rc1-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.3.1rc1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
tf_project-0.3.1rc1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for tf_project-0.3.1rc1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
tf_project-0.3.1rc1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for tf_project-0.3.1rc1-py3-none-macosx_11_0_arm64.whl

Total release size: 23.7 MB

Release files / tf_project-0.3.1rc1.tar.gz

Download URL tf_project-0.3.1rc1.tar.gz
Size 89.1 kB
Tags Source
SHA-256 checksum
How to use checksums
af8fde33310348894f8c35c4f9568821c2465af68e006b11fc7774a3a84c05ed
BLAKE2b-256 checksum
How to use checksums
141d59cf188f7971fcd3400203aed603c11a90a4e01661afcff820cee6ca28dc
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 26, 2026.

Transparency log

Release files / tf_project-0.3.1rc1-py3-none-win_amd64.whl

Download URL tf_project-0.3.1rc1-py3-none-win_amd64.whl
Size 5.8 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a9ca99a66cea6e45eefd81aaf0becbecd2933a167d5a9c1692ccd08e38761bff
BLAKE2b-256 checksum
How to use checksums
57d0acb9e6acea4ec1bf9fec764db28cb16299b60e1573a6fb99b1407c90f52d
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 26, 2026.

Transparency log

Release files / tf_project-0.3.1rc1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL tf_project-0.3.1rc1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 6.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
98047f35286d574dbd612ab7d4769ca61fdd9fce0e587fc8ec48c5c0cac2c7a6
BLAKE2b-256 checksum
How to use checksums
f25b3137290064e3cf389c7d514852ac57391aa7bdfdf66f9d636180bff84151
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 26, 2026.

Transparency log

Release files / tf_project-0.3.1rc1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL tf_project-0.3.1rc1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.8 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
8488ab88e298ce7c4ac1ded4457531479c6ef617ef15f6311be6b833e960003c
BLAKE2b-256 checksum
How to use checksums
68daa708f106065828b326c1d03dc26339d17bdb39df9d8f597084dd36ff22e6
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 26, 2026.

Transparency log

Release files / tf_project-0.3.1rc1-py3-none-macosx_11_0_arm64.whl

Download URL tf_project-0.3.1rc1-py3-none-macosx_11_0_arm64.whl
Size 5.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
83d9b7ca544e2c08023af48015dad17031620ff8fdd821a5c93bd0bf30e2d415
BLAKE2b-256 checksum
How to use checksums
59a3119e3082ae1c97df22dbed88043c30741e2e2568b94c1caee1c2b2131e58
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 26, 2026.

Transparency log

Security for tf-project 0.3.1rc1

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for tf_project-0.3.1rc1.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 26, 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