Skip to main content

No project description provided

Project description

terraflex

Construct custom backends for your terraform project!

[!NOTE]
This project is still WIP in early stages - there might be some bugs - you are welcome to open issues when any encounted

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

Recommended: Use uv tooling

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

[!WARNING]
Make sure to not lose your encryption key - back it up! If you lose this key you wont be able to reopen the terraform state at all!

Others

  • Checkout issues to see roadmap.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terraflex-0.4.3.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terraflex-0.4.3-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file terraflex-0.4.3.tar.gz.

File metadata

  • Download URL: terraflex-0.4.3.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for terraflex-0.4.3.tar.gz
Algorithm Hash digest
SHA256 771b3e71ecdb226217d322a8fd0994d83085858ab3bbc304d2ea4b0dc6219bbe
MD5 f26269fe7ece9b7647eaf1427f9a4e4b
BLAKE2b-256 e855959bb472a631079d0d9f4f3a01ef5d5ea3dc41e089932edd356a24910ede

See more details on using hashes here.

File details

Details for the file terraflex-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: terraflex-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for terraflex-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e8f436d168c9fb8f3944a3d758ea2fb0f8e4b241eb217511a57f3c4ae07895b4
MD5 2355a3db4e359e2d5cc9c3a1c4396b41
BLAKE2b-256 87c52c882a5dc389b05aff35e745932f9d5cd212743420f5a23a547f03125443

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page