Skip to content

ellerbrock/terraform-consul-backend

Repository files navigation

alibaba cloud

Terraform Consul Backend Docker

Open Source Love Gitter Chat MIT Licence

Configuration

Quick and dirty Setup to use Consul as Backend for Terraform.
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 http://localhost:8500.

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:
      - devops

networks:
  devops:
    driver: bridge

volumes:
  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

GithubDockernpmTwitterFacebookGoogle+Gitter

License

MIT license

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.

Releases

No releases published

Packages

No packages published

Languages