This contains HashiCorp code to do the following:
- Packer template to build an Ubuntu 18.04 image consisting of 'HashiStack', which is Consul, Nomad and Vault
- Terraform code to provision the HashiStack in 2-3 separate AWS regions with peering
- Automated cluster formation of Consul and Nomad in each region
- Automated cluster formation of Vault in each region
- Automated WAN joining of Consul and Nomad
- Automated replication configuration of Vault clusters in each region
- Packer and Terraform are available on local machine
- Vault Enterprise linux binary available locally (Consul Enterprise and Nomad Enterpise are optional)
- User possesses AWS account and credentials
- Download Consul, Nomad, and Vault binaries locally (Vault enterprise required, Consul and Nomad Enterprise )
- Copy packer/vars.json.example to packer/vars.json
- Configure variables local path to those binaries in packer/vars.json
- Ensure AWS credentials are exposed as environment variables
- Expose AWS environment variables to avoid AMI copy timeouts.
export AWS_MAX_ATTEMPTS=60 && export AWS_POLL_DELAY_SECONDS=60
- Execute Packer build
cd packer
# CentOS 7(default)
packer build -var-file=vars.json -only=amazon-ebs-centos-7 packer.json
# RHEL 7.5 - Additional licensing costs
packer build -var-file=vars.json -only=amazon-ebs-rhel-7.5-systemd packer.json
Configure Terraform variables
cp terraform.tfvars.example terraform.tfvars
# edit terraform.tfvars
Initialize Terraform
cd terraform
terraform init
Terraform plan execution with summary of changes
terraform plan
Terraform apply to create infrastructure
terraform apply
# apply execution without prompt
# terraform apply -auto-approve
Tear down infrastructure using Terraform destroy
terraform destroy -force