https://github.com/ellerbrock/terraform-consul-backend
:jack_o_lantern: consul as backend for terraform with docker
https://github.com/ellerbrock/terraform-consul-backend
consul consul-server docker docker-compose terraform terraform-backend
Last synced: 3 months ago
JSON representation
:jack_o_lantern: consul as backend for terraform with docker
- Host: GitHub
- URL: https://github.com/ellerbrock/terraform-consul-backend
- Owner: ellerbrock
- License: mit
- Created: 2018-01-13T06:39:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-13T06:39:46.000Z (over 7 years ago)
- Last Synced: 2025-01-26T06:41:18.603Z (5 months ago)
- Topics: consul, consul-server, docker, docker-compose, terraform, terraform-backend
- Language: HCL
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README

# Terraform Consul Backend Docker
[](https://github.com/ellerbrock/open-source-badges/) [](https://gitter.im/frapsoft/frapsoft/) [](https://opensource.org/licenses/mit-license.php)## Configuration
Quick and dirty Setup to use [Consul](https://www.consul.io/) as [Backend](https://www.terraform.io/docs/backends/types/consul.html) for [Terraform](https://www.terraform.io/).
I currently need a quick solution for Alibaba Cloud to store my state.
This is just a first test without SSL or any deep dive in security or stability.
But it works and from there we can take it futher next time ...Run with `docker-compose up` and you can see the WebGUI on .
### `docker-compose.yml`
```
version: '3'services:
consul:
image: consul:latest
container_name: consul
volumes:
- consul-data:/consul/data
environment:
- CONSUL_HTTP_TOKEN="supersecure"
ports:
- 8300:8300/tcp
- 8301:8301/tcp
- 8301:8301/udp
- 8302:8302/tcp
- 8302:8302/udp
- 8400:8400/tcp
- 8500:8500/tcp
- 8600:8600/tcp
- 8600:8600/udp
networks:
- devopsnetworks:
devops:
driver: bridgevolumes:
consul-data:
```### `main.tf`
```
terraform {
required_version = ">= 0.11.2"backend "consul" {
address = "localhost:8500"
path = "tf/state"
access_token = "supersecure"
lock = true
}
}
```### What's next
- secure transfere via ssl certificates
- further look how to use vault to store secrets
- cluster setup## Contact
[](https://github.com/ellerbrock/)[](https://hub.docker.com/u/ellerbrock/)[](https://www.npmjs.com/~ellerbrock)[](https://twitter.com/frapsoft/)[](https://www.facebook.com/frapsoft/)[](https://plus.google.com/116540931335841862774)[](https://gitter.im/frapsoft/frapsoft/)
## License
[](https://opensource.org/licenses/mit-license.php)
This work by Maik Ellerbrock is licensed under a Creative Commons Attribution 4.0 International License and the underlying source code is licensed under the MIT license.