talebbits / terraform-google-consul

A Terraform Module for how to run Consul on Google Cloud using Terraform and Packer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maintained by Gruntwork.io

Consul for Google Cloud Platform (GCP)

This repo contains a Terraform Module for how to deploy a Consul cluster on GCP using Terraform. Consul is a distributed, highly-available tool that you can use for service discovery and key/value storage. A Consul cluster typically includes a small number of server nodes, which are responsible for being part of the consensus quorum, and a larger number of client nodes, which you typically run alongside your apps:

Consul architecture

How to use this Module

Each Module has the following folder structure:

  • modules: This folder contains the reusable code for this Module, broken down into one or more submodules.
  • examples: This folder contains examples of how to use the submodules.
  • test: Automated tests for the submodules and examples.

To deploy Consul servers using this Module:

  1. Create a Consul Image using a Packer template that references the install-consul module. Here is an example Packer template. Note that Google Cloud does not support custom public Images so you must build this Packer template on your own to proceed.

  2. Deploy that Image across a Compute Instance Group using the Terraform consul-cluster module and execute the run-consul script with the --server flag during boot on each Instance in the Compute Instance Group to form the Consul cluster. Here is an example Terraform configuration to provision a Consul cluster.

To deploy Consul clients using this Module:

  1. Use the install-consul module to install Consul alongside your application code.
  2. Before booting your app, execute the run-consul script with --client flag.
  3. Your app can now usr the local Consul agent for service discovery and key/value storage.
  4. Optionally, you can use the install-dnsmasq module to configure Consul as the DNS for a specific domain (e.g. .consul) so that URLs such as foo.service.consul resolve automatically to the IP address(es) for a service foo registered in Consul (all other domain names will be continue to resolve using the default resolver on the OS).

What's a Terraform Module?

A Terraform Module refers to a self-contained packages of Terraform configurations that are managed as a group. This repo is a Terraform Module and contains many "submodules" which can be composed together to create useful infrastructure patterns.

Who maintains this Terraform Module?

This Terraform Module is maintained by Gruntwork. If you're looking for help or commercial support, send an email to modules@gruntwork.io. Gruntwork can help with:

  • Setup, customization, and support for this Terraform Module.
  • Terraform Module for other types of Google Cloud infrastructure.
  • Terraform Modules that meet compliance requirements, such as HIPAA.
  • Consulting & Training on Google Cloud, AWS, Terraform, and DevOps.

Code included in this Terraform Module:

  • install-consul: This module installs Consul using a Packer template to create a Consul Custom Image.

  • consul-cluster: The module includes Terraform code to deploy a Consul Image across a Managed Compute Instance Group.

  • run-consul: This module includes the scripts to configure and run Consul. It is used by the above Packer module at build-time to set configurations, and by the Terraform module at runtime with the Instance's Startup Script to create the cluster.

  • install-dnsmasq module: Install Dnsmasq and configure it to forward requests for a specific domain to Consul. This allows you to use Consul as a DNS server for URLs such as foo.service.consul.

How do I contribute to this Terraform Module?

Contributions are very welcome! Check out the Contribution Guidelines for instructions.

How is this Terraform Module versioned?

This Terraform Module follows the principles of Semantic Versioning. You can find each new release, along with the changelog, in the Releases Page.

During initial development, the major version will be 0 (e.g., 0.x.y), which indicates the code does not yet have a stable API. Once we hit 1.0.0, we will make every effort to maintain a backwards compatible API and use the MAJOR, MINOR, and PATCH versions on each release to indicate any incompatibilities.

License

This code is released under the Apache 2.0 License. Please see LICENSE and NOTICE for more details.

Copyright © 2017 Gruntwork, Inc.

About

A Terraform Module for how to run Consul on Google Cloud using Terraform and Packer

License:Apache License 2.0


Languages

Language:HCL 47.4%Language:Shell 38.5%Language:Go 14.1%