github.com/tetrafolium/tflint@v0.8.0/tflint/test-fixtures/v0.11.0_module/.terraform/modules/abc3234899392665e7e4875ddfd1340d/hashicorp-terraform-aws-consul-ee980b4/README.md (about) 1 # Consul AWS Module 2 3 This repo contains a Module for how to deploy a [Consul](https://www.consul.io/) cluster on 4 [AWS](https://aws.amazon.com/) using [Terraform](https://www.terraform.io/). Consul is a distributed, highly-available 5 tool that you can use for service discovery and key/value storage. A Consul cluster typically includes a small number 6 of server nodes, which are responsible for being part of the [consensus 7 quorum](https://www.consul.io/docs/internals/consensus.html), and a larger number of client nodes, which you typically 8 run alongside your apps: 9 10 ![Consul architecture](https://github.com/hashicorp/terraform-aws-consul/blob/master/_docs/architecture.png?raw=true) 11 12 13 14 ## How to use this Module 15 16 Each Module has the following folder structure: 17 18 * [root](https://github.com/hashicorp/terraform-aws-consul/tree/master): This folder shows an example of Terraform code 19 that uses the [consul-cluster](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/consul-cluster) 20 module to deploy a [Consul](https://www.consul.io/) cluster in [AWS](https://aws.amazon.com/). 21 * [modules](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules): This folder contains the reusable code for this Module, broken down into one or more modules. 22 * [examples](https://github.com/hashicorp/terraform-aws-consul/tree/master/examples): This folder contains examples of how to use the modules. 23 * [test](https://github.com/hashicorp/terraform-aws-consul/tree/master/test): Automated tests for the modules and examples. 24 25 To deploy Consul servers using this Module: 26 27 1. Create a Consul AMI using a Packer template that references the [install-consul module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-consul). 28 Here is an [example Packer template](https://github.com/hashicorp/terraform-aws-consul/tree/master/examples/consul-ami#quick-start). 29 30 If you are just experimenting with this Module, you may find it more convenient to use one of our official public AMIs: 31 - [Latest Ubuntu 16 AMIs](https://github.com/hashicorp/terraform-aws-consul/tree/master/_docs/ubuntu16-ami-list.md). 32 - [Latest Amazon Linux AMIs](https://github.com/hashicorp/terraform-aws-consul/tree/master/_docs/amazon-linux-ami-list.md). 33 34 **WARNING! Do NOT use these AMIs in your production setup. In production, you should build your own AMIs in your own 35 AWS account.** 36 37 1. Deploy that AMI across an Auto Scaling Group using the Terraform [consul-cluster module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/consul-cluster) 38 and execute the [run-consul script](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/run-consul) with the `--server` flag during boot on each 39 Instance in the Auto Scaling Group to form the Consul cluster. Here is [an example Terraform 40 configuration](https://github.com/hashicorp/terraform-aws-consul/tree/master/MAIN.md#quick-start) to provision a Consul cluster. 41 42 To deploy Consul clients using this Module: 43 44 1. Use the [install-consul module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-consul) to install Consul alongside your application code. 45 1. Before booting your app, execute the [run-consul script](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/run-consul) with `--client` flag. 46 1. Your app can now using the local Consul agent for service discovery and key/value storage. 47 1. Optionally, you can use the [install-dnsmasq module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-dnsmasq) to configure Consul as the DNS for a 48 specific domain (e.g. `.consul`) so that URLs such as `foo.service.consul` resolve automatically to the IP 49 address(es) for a service `foo` registered in Consul (all other domain names will be continue to resolve using the 50 default resolver on the OS). 51 52 53 54 55 ## What's a Module? 56 57 A Module is a canonical, reusable, best-practices definition for how to run a single piece of infrastructure, such 58 as a database or server cluster. Each Module is created using [Terraform](https://www.terraform.io/), and 59 includes automated tests, examples, and documentation. It is maintained both by the open source community and 60 companies that provide commercial support. 61 62 Instead of figuring out the details of how to run a piece of infrastructure from scratch, you can reuse 63 existing code that has been proven in production. And instead of maintaining all that infrastructure code yourself, 64 you can leverage the work of the Module community to pick up infrastructure improvements through 65 a version number bump. 66 67 68 69 ## Who maintains this Module? 70 71 This Module is maintained by [Gruntwork](http://www.gruntwork.io/). If you're looking for help or commercial 72 support, send an email to [modules@gruntwork.io](mailto:modules@gruntwork.io?Subject=Consul%20Module). 73 Gruntwork can help with: 74 75 * Setup, customization, and support for this Module. 76 * Modules for other types of infrastructure, such as VPCs, Docker clusters, databases, and continuous integration. 77 * Modules that meet compliance requirements, such as HIPAA. 78 * Consulting & Training on AWS, Terraform, and DevOps. 79 80 81 82 ## Code included in this Module: 83 84 * [install-consul](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-consul): This module installs Consul using a 85 [Packer](https://www.packer.io/) template to create a Consul 86 [Amazon Machine Image (AMI)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html). 87 88 * [consul-cluster](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/consul-cluster): The module includes Terraform code to deploy a Consul AMI across an [Auto 89 Scaling Group](https://aws.amazon.com/autoscaling/). 90 91 * [run-consul](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/run-consul): This module includes the scripts to configure and run Consul. It is used 92 by the above Packer module at build-time to set configurations, and by the Terraform module at runtime 93 with [User Data](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts) 94 to create the cluster. 95 96 * [install-dnsmasq module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-dnsmasq): Install [Dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) 97 and configure it to forward requests for a specific domain to Consul. This allows you to use Consul as a DNS server 98 for URLs such as `foo.service.consul`. 99 100 * [consul-iam-policies](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/consul-iam-policies): Defines the IAM policies necessary for a Consul cluster. 101 102 * [consul-security-group-rules](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/consul-security-group-rules): Defines the security group rules used by a 103 Consul cluster to control the traffic that is allowed to go in and out of the cluster. 104 105 106 107 108 ## How do I contribute to this Module? 109 110 Contributions are very welcome! Check out the [Contribution Guidelines](https://github.com/hashicorp/terraform-aws-consul/tree/master/CONTRIBUTING.md) for instructions. 111 112 113 114 ## How is this Module versioned? 115 116 This Module follows the principles of [Semantic Versioning](http://semver.org/). You can find each new release, 117 along with the changelog, in the [Releases Page](../../releases). 118 119 During initial development, the major version will be 0 (e.g., `0.x.y`), which indicates the code does not yet have a 120 stable API. Once we hit `1.0.0`, we will make every effort to maintain a backwards compatible API and use the MAJOR, 121 MINOR, and PATCH versions on each release to indicate any incompatibilities. 122 123 124 125 ## License 126 127 This code is released under the Apache 2.0 License. Please see [LICENSE](https://github.com/hashicorp/terraform-aws-consul/tree/master/LICENSE) and [NOTICE](https://github.com/hashicorp/terraform-aws-consul/tree/master/NOTICE) for more 128 details. 129 130 Copyright © 2017 Gruntwork, Inc.