Categorygithub.com/ironpinguin/terraform_http_backend
modulepackage
0.1.1
Repository: https://github.com/ironpinguin/terraform_http_backend.git
Documentation: pkg.go.dev

# README

terraform http backend

Go Version Coverage Status run tests

This is a simple go lang implementation of the terraform http backend protocol including locking. To store the information there is current only the filesystem used.

Configuration (Environment)

The http server can be configured over environment variables set in the system or in the .env file.

Follow Environment are availibe:

VariableDescriptionDefault
TF_STORAGE_DIRdirectory to store the uploaded terraform state file and the lock state./store
TF_AUTH_ENABLEDboolean to enable or disable basic auth securityfalse
TF_USERNAMEUsername for the basic auth security only used if TF_AUTH_ENABLED is trueadmin
TF_PASSWORDPassword for the basic auth security only used if TF_AUTH_ENABLED is trueadmin
TF_PORTThe Port where this server will listen8080
TF_IPThe ip addr for the server to listen. If none is set the server will listen on all interfaces127.0.0.1

Usage

Download latest release config your .env file or set the environment varibles. Than you can simple start the server with ./terraform_http_backend

Upcomming

I the future there will be a docker image and also a example systemd start script

# Functions

GetLogger returns the logger instance.
SetLogger sets the logger instance This is useful in testing as the logger can be overridden with a test logger.

# Structs

Backend struct to serve as backend for terraform http backend storage.
Config used to load configuration.
ConflictError if there is a locking conflict.
FileNotExistsError used if the file not exists.
LockInfo copied from https://github.com/hashicorp/terraform/blob/main/internal/states/statemgr/locker.go#L115.