Coder Social home page Coder Social logo

simple-terraform-backend's Introduction

Terraform FastAPI Backend

This project implements a custom HTTP backend for Terraform using FastAPI. It provides endpoints for state management and locking, allowing Terraform to store and retrieve state information, as well as implement state locking for concurrent operations.

Features

  • Store and retrieve Terraform state
  • Implement state locking mechanism
  • Compatible with Terraform's HTTP backend

Requirements

see requirements.txt

Installation

  1. Clone this repository:
git clone [email protected]:mikelv702/simple-terraform-backend.git
  1. Install the required packages:
uv pip install -r requirements.txt

Usage

  1. Start the FastAPI server:
cd src/
fastapi dev main.py
  1. Configure Terraform to use this backend:
terraform {
  backend "http" {
    address = "http://localhost:8000/tfstate/${PROJECT_ID}"
    lock_address = "http://localhost:8000/tfstate/${PROJECT_ID}/lock"
    unlock_address = "http://localhost:8000/tfstate/${PROJECT_ID}/lock"
  }
}
  1. Use Terraform as normal. The state will be stored and retrieved from your FastAPI backend.

Note

This is a basic implementation and should not be used in production without further security measures and persistent storage solutions.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

simple-terraform-backend's People

Contributors

mikelv702 avatar

Watchers

 avatar

simple-terraform-backend's Issues

Multiple State Files

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
User should be able to save multiple state files for different terraform projects or environments

Describe alternatives you've considered
None

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.