Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Update readme #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
Contributions to this Module are very welcome! We follow a fairly standard [pull request
process](https://help.github.com/articles/about-pull-requests/) for contributions, subject to the following guidelines:

1. [File a GitHub issue](#file-a-github-issue)
1. [Update the documentation](#update-the-documentation)
1. [Update the tests](#update-the-tests)
1. [Update the code](#update-the-code)
1. [Create a pull request](#create-a-pull-request)
1. [Merge and release](#merge-and-release)
- [File a GitHub issue](#file-a-github-issue)
- [Update the documentation](#update-the-documentation)
- [Update the tests](#update-the-tests)
- [Update the code](#update-the-code)
- [Create a pull request](#create-a-pull-request)
- [Sign HashiCorp CLA](#sign-hashicorp-cla)
- [Merge and release](#merge-and-release)

## File a GitHub issue

Expand Down Expand Up @@ -38,7 +39,7 @@ At this point, make your code changes and use your new test case to verify that
keep in mind two things:

1. Backwards compatibility
1. Downtime
2. Downtime

### Backwards compatibility

Expand Down Expand Up @@ -80,6 +81,10 @@ to include the following:
test output so we can verify that everything is working.
1. Any notes on backwards incompatibility or downtime.

## Sign HashiCorp CLA

We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. You can read more about HashiCorp's CLA and why we require all contributors to sign it in our [guide to the CLA](https://www.hashicorp.com/cla)

## Merge and release

The maintainers for this repo will review your code and provide feedback. If everything looks good, they will merge the
Expand Down
118 changes: 45 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,81 @@
<!--
:type: service
:name: HashiCorp Consul
:icon: /_docs/consul.png
:description: Deploy a Consul cluster. Supports automatic bootstrapping, DNS, Consul UI, and auto healing.
:category: Service discovery, service mesh
:cloud: google
:tags: consul, iam
:license: open-source
:built-with: terraform
-->

[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_gcp_consul)
![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.12.0-blue.svg)
# Consul for Google Cloud Platform (GCP)

This repo contains a Terraform Module for how to deploy a [Consul](https://www.consul.io/) cluster on
[GCP](https://cloud.google.com/) using [Terraform](https://www.terraform.io/). 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](https://www.consul.io/docs/internals/consensus.html), and a larger number of client nodes, which you typically
run alongside your apps:

![Consul architecture](https://github.com/hashicorp/terraform-google-consul/blob/master/_docs/architecture.png?raw=true)



## How to use this Module

Each Module has the following folder structure:

* [modules](https://github.com/hashicorp/terraform-google-consul/tree/master/modules): This folder contains the reusable
code for this Module, broken down into one or more submodules.
* [examples](https://github.com/hashicorp/terraform-google-consul/tree/master/examples): This folder contains examples
of how to use the submodules.
* [test](https://github.com/hashicorp/terraform-google-consul/tree/master/test): Automated tests for the submodules and
examples.
of server nodes, which are responsible for being part of the [consensus quorum](https://www.consul.io/docs/internals/consensus.html), and a larger number of client nodes, which you typically run alongside your apps:

To deploy Consul servers using this Module:
![Terraform Google Consul](https://raw.githubusercontent.com/hashicorp/terraform-google-consul/master/_docs/architecture.png)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
![Terraform Google Consul](https://raw.githubusercontent.com/hashicorp/terraform-google-consul/master/_docs/architecture.png)
![Terraform Google Consul](https://raw.githubusercontent.com/hashicorp/terraform-google-consul/master/_docs/architecture.png)


1. Create a Consul Image using a Packer template that references the [install-consul module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-consul).
Here is an [example Packer template](https://github.com/hashicorp/terraform-google-consul/tree/master/examples/consul-image#quick-start). Note that Google Cloud does not support custom
public Images so you must build this Packer template on your own to proceed.

1. Deploy that Image across a Compute Instance Group using the Terraform [consul-cluster module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/consul-cluster)
and execute the [run-consul script](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/run-consul) 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](https://github.com/hashicorp/terraform-google-consul/tree/master/examples/root-example#quick-start) to provision a Consul cluster.
## Features
* Deploy Consul servers and agents
* Automatic bootstrapping
* Auto healing
* Auto DNS configuration
* Consul UI


To deploy Consul clients using this Module:
## Learn

1. Use the [install-consul module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-consul) to install Consul alongside your application code.
1. Before booting your app, execute the [run-consul script](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/run-consul) with `--client` flag.
1. Your app can now usr the local Consul agent for service discovery and key/value storage.
1. Optionally, you can use the [install-dnsmasq module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-dnsmasq) 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).
This repo is maintained by [Gruntwork](https://www.gruntwork.io), and follows the same patterns as [the Gruntwork Infrastructure as Code Library](https://gruntwork.io/infrastructure-as-code-library/), a collection of reusable, battle-tested, production ready infrastructure code. You can read [How to use the Gruntwork Infrastructure as Code Library](https://gruntwork.io/guides/foundations/how-to-use-gruntwork-infrastructure-as-code-library/) for an overview of how to use modules maintained by Gruntwork!

## Core concepts

* Consul Use Cases: overview of various use cases that consul is optimized for.
* [Service Discovery](https://www.consul.io/discovery.html)

* [Service Mesh](https://www.consul.io/mesh.html)

## What's a Terraform Module?
* [Consul Guides](https://learn.hashicorp.com/consul?utm_source=consul.io&utm_medium=docs&utm_content=top-nav): official guide on how to use Consul service to discover services and secure network traffic.

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.

* [Deploy Consul Servers and Clients](core-concepts.md): Learn how to deploy consul servers and clients using this repo.

## Repo organization

## Who maintains this Terraform Module?
* [modules](https://github.com/hashicorp/terraform-google-consul/tree/master/modules): the main implementation code for this repo, broken down into multiple standalone, orthogonal submodules.
* [examples](https://github.com/hashicorp/terraform-google-consul/tree/master/examples): This folder shows examples of different ways to combine the modules in the `modules` folder to deploy Consul.
* [test](https://github.com/hashicorp/terraform-google-consul/tree/master/test): Automated tests for the modules and examples.
* [root](https://github.com/hashicorp/terraform-google-consul/tree/master): The root folder is *an example* of how to use the [consul-cluster module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/consul-cluster) module to deploy a [Consul](https://www.consul.io/) cluster in [GCP](https://cloud.google.com/). The Terraform Registry requires the root of every repo to contain Terraform code, so we've put one of the examples there. This example is great for learning and experimenting, but for production use, please use the underlying modules in the [modules folder](https://github.com/hashicorp/terraform-google-consul/tree/master/modules) directly.

This Terraform Module is maintained by [Gruntwork](http://www.gruntwork.io/). If you're looking for help or commercial
support, send an email to [[email protected]](mailto:[email protected]?Subject=Consul%20Terraform%20Module).
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.
## Deploy

### Non-production deployment (quick start for learning)
If you just want to try this repo out for experimenting and learning, check out the following resources:

* [examples folder](https://github.com/hashicorp/terraform-google-consul/tree/master/examples): The `examples` folder contains sample code optimized for learning, experimenting, and testing (but not production usage).

## Code included in this Terraform Module:
### Production deployment

* [install-consul](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-consul): This module installs Consul using a [Packer](https://www.packer.io/)
template to create a Consul [Custom Image](https://cloud.google.com/compute/docs/images).
If you want to deploy this repo in production, check out the following resources:

* [consul-cluster](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/consul-cluster): The module includes Terraform code to deploy a Consul Image across a [Managed
Compute Instance Group](https://cloud.google.com/compute/docs/instance-groups/).
* [Consul Setup Guide](https://learn.hashicorp.com/consul/datacenter-deploy/deployment-guide)

* [run-consul](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/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](https://cloud.google.com/compute/docs/startupscript) to create the cluster.
## Support
If you need help with this repo or anything else related to infrastructure or DevOps, Gruntwork offers [Commercial Support](https://gruntwork.io/support/) via Slack, email, and phone/video. If you're already a Gruntwork customer, hop on Slack and ask away! If not, [subscribe now](https://www.gruntwork.io/pricing/). If you're not sure, feel free to email us at [[email protected]](mailto:[email protected]).

* [install-dnsmasq module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-dnsmasq): Install [Dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html)
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?
## How do I contribute to this Module?

Contributions are very welcome! Check out the [Contribution Guidelines](https://github.com/hashicorp/terraform-google-consul/tree/master/CONTRIBUTING.md) for instructions.



## How is this Terraform Module versioned?

This Terraform Module follows the principles of [Semantic Versioning](http://semver.org/). You can find each new release,
along with the changelog, in the [Releases Page](https://github.com/hashicorp/terraform-google-consul/releases).

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](https://github.com/hashicorp/terraform-google-consul/tree/master/LICENSE) and [NOTICE](https://github.com/hashicorp/terraform-google-consul/tree/master/NOTICE) for more
details.

Copyright &copy; 2017 Gruntwork, Inc.
Please see [LICENSE](LICENSE) for details on how the code in this repo is licensed.
Binary file added _docs/consul.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions core-concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#### To deploy Consul servers for production using this repo:

1. Create a Consul Image using a Packer template that references the [install-consul module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-consul).
Here is an [example Packer template](https://github.com/hashicorp/terraform-google-consul/tree/master/examples/consul-image#quick-start).
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](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/consul-cluster)
and execute the [run-consul script](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/run-consul) 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](https://github.com/hashicorp/terraform-google-consul/tree/master/examples/root-example#quick-start) to provision a Consul cluster.

#### To deploy Consul clients for production using this repo:

1. Use the [install-consul module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-consul) to install Consul alongside your application code.
1. Before booting your app, execute the [run-consul script](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/run-consul) with `--client` flag.
1. Your app can now use the local Consul agent for service discovery and key/value storage.
1. Optionally, you can use the [install-dnsmasq module](https://github.com/hashicorp/terraform-google-consul/tree/master/modules/install-dnsmasq) 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).