Skip to main content

terraflex

Construct custom backends for your terraform project!

why?

I started this project to provide a free solution for homelabs IAC.
The major constraint here is to find a free backend that I feel safe to use and to have a 0 bootstrap layer if possible.
I found several solutions around this - but most were using a 3rd party hosted http backend servers.
Those backends were problematic for me because I had issues trusting them to store my sensitive state files - and the fact that I didn't own the storage location - made me afraid that I might lose those state files - and we all know how bad it is to lose your state files :P.
The closest solution I found was terraform-backend-git - which this project was heavily influenced on - so go check it out as well!
Eventually I had the idea of creating an extendable modular terraform http backend - which allows customizing the state using transformations (like encryption), and getting starting with it will be as simple as running single command.

Documentation

Check out documentations here: docs

Installation

Install uv (if not already):

curl -Ls https://astral.sh/uv/install.sh | sh

Install terraflex globally using uv tooling (from PyPI):

uv tool install terraflex

Or install the latest version directly from GitHub:

uv tool install git+https://github.com/IamShobe/terraflex.git

Upgrade terraflex:

uv tool upgrade terraflex

To use terraflex in a project with dev dependencies, you can still use:

uv sync -G dev

Getting started

Git backends preparation

  • Create new repository to store your state at
  • Make sure the repository is initialized with primary branch (main)

Common

  • To start - cd to your IAC repo, for example: ~/git/iac
  • Run:
    terraflex init
    
    Follow the wizard
  • Update your backend:
    backend "http" {
      address = "http://localhost:8600/state"
      lock_address = "http://localhost:8600/lock"
      lock_method = "PUT"
      unlock_address = "http://localhost:8600/lock"
      unlock_method = "DELETE"
    }
    
  • Run any terraform command using terraflex wrap -- <command> - for example:
    terraflex wrap -- terraform init
    
  • You can also create a full shell with the context of the backend:
    terraflex wrap -- $SHELL
    

terraflex init

Others

  • Checkout issues to see roadmap.

Metadata

Release files for terraflex 0.4.3

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

Source distribution (sdist)

Source distribution for terraflex 0.4.3
File Size Uploaded
terraflex-0.4.3.tar.gz 35.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for terraflex 0.4.3
File Interpreter ABI Platform
terraflex-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 82.1 kB

Release files / terraflex-0.4.3.tar.gz

Download URL terraflex-0.4.3.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
771b3e71ecdb226217d322a8fd0994d83085858ab3bbc304d2ea4b0dc6219bbe
BLAKE2b-256 checksum
How to use checksums
e855959bb472a631079d0d9f4f3a01ef5d5ea3dc41e089932edd356a24910ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / terraflex-0.4.3-py3-none-any.whl

Download URL terraflex-0.4.3-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8f436d168c9fb8f3944a3d758ea2fb0f8e4b241eb217511a57f3c4ae07895b4
BLAKE2b-256 checksum
How to use checksums
87c52c882a5dc389b05aff35e745932f9d5cd212743420f5a23a547f03125443
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

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