A simple standalone webserver for Terraform HTTP remote state written in Go.
- Basic Authentication
- State Locking
- Overview of stored states
- For now you have to provide a JSON config file. The most minimum content has to be:
{}
-
Starting docker container:
docker run --rm --detach \ --name terrastate-http \ --publish 8080:8080 \ --volume $(pwd)/example-config.json:/mnt/configs/config.json \ --volume $(pwd)/sqlite3/:/mnt/sqlite3/ \ psolru/terrastate-http
-
Configure Terraform (e.g. in backend.yml):
terraform { backend "http" { address = "http://terrastate.example.com:8080/my_terraform_project" lock_address = "http://terrastate.example.com:8080/my_terraform_project/lock" unlock_address = "http://terrastate.example.com:8080/my_terraform_project/unlock" username = "my_username" password = "my_password" } }
-
optional: Setup Reverse Proxy
-
enjoy your secure, remote and self managed Terraform Statemanagement
SSL is currently not supported. You have to manage this by your own. (But i planned it to be a future feature.)
Terrastate is written by considering the specifications of Terraforms http backend.
Therefore the routes are self mostly explaining.
"/list" is an exception and added by the idea to have a slight overview of the stored states.
Overview:
- "/list" [GET] - Returns all States and their ID, eg.:
{"13":"my_fancy_cluster"}
- "/{ident}" [GET]
- "/{ident}" [POST]
- "/{ident}/lock" [LOCK]
- "/{ident}/unlock" [UNLOCK]
This is my first go project. There are many things which could be done better and I already have a little todo list. If you think there are some critical things which should be prioritized please open an issue about it. Thank you!