Giter Site home page Giter Site logo

lutonite / terraform-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nimbolus/terraform-backend

0.0 0.0 0.0 357 KB

A state backend server which implements the Terraform HTTP backend API with pluggable modules for authentication, storage, locking and state encryption.

License: BSD 3-Clause "New" or "Revised" License

Shell 0.91% Go 97.90% HCL 0.43% Dockerfile 0.76%

terraform-backend's Introduction

Terraform Backend Server

A state backend server which implements the Terraform HTTP backend API with plugable modules for authentication, storage, locking and state encryption.

โš ๏ธ Disclaimer: This code is in an early development state and not tested extensively for bugs and security issues. If you find some, please raise an issue or merge request.

Supported authentication methods:

  • HTTP basic auth
  • JSON Web Tokens

Supported storage backends:

  • local file system
  • S3
  • Postgres

Supported lock backends:

  • local map
  • Redis
  • Postgres

Supported KMS (encryption) backends:

  • local AES key
  • AES from HashiCorp Vault Key/Value store (v2)
  • HashiCorp Vault Transit engine

Deployment

Run locally for development:

LOG_LEVEL=debug go run cmd/terraform-backend.go

or use docker-compose:

docker-compose up -d

Default settings

The following table describes the default configuration, although the backend server will run with these values, it's not scalable and therefore only for testing purposes.

Environment Variable Type Default Description
LOG_LEVEL string info Log level (options are: fatal, info, warning, debug, trace)
LISTEN_ADDR string :8080 Address the HTTP server listens on
TLS_KEY string -- Path to TLS key file for listening with TLS (fallback to HTTP if not specified)
TLS_CERT string -- Path to TLS certificate file for listening with TLS (fallback to HTTP if not specified)
STORAGE_BACKEND string fs Module for state file storage (checkout docs/storage.md for other options)
STORAGE_FS_DIR string ./states File system directory for fs storage module to store state files
KMS_BACKEND string local Module used for encryption (checkout docs/kms.md for other options)
KMS_KEY string -- Key for local KMS module, if not defined, the server will generate a new one and exit
LOCK_BACKEND string local Module used for locking the state (checkout docs/lock.md for other options)
AUTH_BASIC_ENABLED bool true HTTP basic auth is enabled by default (checkout docs/auth.md for other options)

Usage

The path to the state is: /state/<project-id>/<state-name>.

Example Terraform backend configuration

terraform {
  backend "http" {
    address        = "http://localhost:8080/state/project1/example"
    lock_address   = "http://localhost:8080/state/project1/example"
    unlock_address = "http://localhost:8080/state/project1/example"
    username       = "basic"
    password       = "some-random-secret"
  }
}

For more information about username and password checkout docs/auth.md

Tests

Run unit tests:

go test ./...

Run integration tests:

docker-compose up -d redis postgres minio
go test ./... --tags integration -count=1

terraform-backend's People

Contributors

lu1as avatar tobikris avatar wind0r avatar dependabot[bot] avatar lutonite avatar

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.