All Projects → antonbabenko → Terragrunt Reference Architecture

antonbabenko / Terragrunt Reference Architecture

Licence: mit
Terragrunt Reference Architecture (upd: May 2020)

Projects that are alternatives of or similar to Terragrunt Reference Architecture

Terraform Aws Jenkins
Terraform module to build Docker image with Jenkins, save it to an ECR repo, and deploy to Elastic Beanstalk running Docker stack
Stars: ✭ 197 (-3.43%)
Mutual labels:  terraform, hcl
Terraform Kubernetes Installer
Terraform Installer for Kubernetes on Oracle Cloud Infrastructure
Stars: ✭ 162 (-20.59%)
Mutual labels:  terraform, hcl
Terraform Kubernetes
Example of deploying a Kubernetes cluster to Google Cloud using Terraform
Stars: ✭ 152 (-25.49%)
Mutual labels:  terraform, hcl
Terraform.tmlanguage
Terraform (HCL) configuration file syntax highlighting for Sublime Text 2 and 3
Stars: ✭ 148 (-27.45%)
Mutual labels:  terraform, hcl
Go Lambda Ping
Deploy a Lambda to Ping a Site in 20 Seconds!
Stars: ✭ 195 (-4.41%)
Mutual labels:  terraform, hcl
Multiregion Terraform
Example multi-region AWS Terraform application
Stars: ✭ 149 (-26.96%)
Mutual labels:  terraform, hcl
Terraform Aws Kubernetes
Terraform module for Kubernetes setup on AWS
Stars: ✭ 159 (-22.06%)
Mutual labels:  terraform, hcl
Terraform Aws Landing Zone
Terraform Module for AWS Landing Zone
Stars: ✭ 142 (-30.39%)
Mutual labels:  terraform, hcl
Terraform Aws Components
Opinionated, self-contained Terraform root modules that each solve one, specific problem
Stars: ✭ 168 (-17.65%)
Mutual labels:  terraform, hcl
Terraform Aws Cloudtrail Cloudwatch Alarms
Terraform module for creating alarms for tracking important changes and occurrences from cloudtrail.
Stars: ✭ 170 (-16.67%)
Mutual labels:  terraform, hcl
Terraform Google Vault
Modular deployment of Vault on Google Compute Engine with Terraform
Stars: ✭ 147 (-27.94%)
Mutual labels:  terraform, hcl
K8s Scw Baremetal
Kubernetes installer for Scaleway bare-metal AMD64 and ARMv7
Stars: ✭ 176 (-13.73%)
Mutual labels:  terraform, hcl
Terraform Aws Labs
Terraform template for AWS provider ☁️
Stars: ✭ 146 (-28.43%)
Mutual labels:  terraform, hcl
Terraform Aws Eks
Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS
Stars: ✭ 2,464 (+1107.84%)
Mutual labels:  terraform, hcl
Tfupdate
Update version constraints in your Terraform configurations
Stars: ✭ 145 (-28.92%)
Mutual labels:  terraform, hcl
Aws Labs
step by step guide for aws mini labs. Currently maintained on : https://github.com/Cloud-Yeti/aws-labs Youtube playlist for labs:
Stars: ✭ 153 (-25%)
Mutual labels:  terraform, hcl
Terraform With Circleci Example
This is an example of automatic deployments of your infrastructure using terraform and CircleCI 2.0 workflows
Stars: ✭ 142 (-30.39%)
Mutual labels:  terraform, hcl
Kubify
Terraform Template to Setup a Kubernetes Cluster on OpenStack/AWS/Azure
Stars: ✭ 142 (-30.39%)
Mutual labels:  terraform, hcl
Terraform Aws Cloudfront S3 Cdn
Terraform module to easily provision CloudFront CDN backed by an S3 origin
Stars: ✭ 162 (-20.59%)
Mutual labels:  terraform, hcl
Tfk8s
A tool for converting Kubernetes YAML manifests to Terraform HCL
Stars: ✭ 167 (-18.14%)
Mutual labels:  terraform, hcl

Acme's Infrastructure - Terragrunt Reference Architecture (updated: May 2020)

This repository contains rather complete infrastructure configurations where Terragrunt is used to manage infrastructure for Acme Corporation.

By the way!

This code is very close to the one produced by modules.tf - open-source infrastructure as code generator from visual diagrams created with Cloudcraft.co. See it yourself in modules.tf-demo!

Introduction

Acme has several environments (prod, staging and dev) entirely separated by AWS accounts.

Infrastructure in each environment consists of multiple layers (autoscaling, alb, vpc, ...) where each layer is configured using one of Terraform AWS modules with arguments specified in terragrunt.hcl in layer's directory.

Terragrunt is used to work with Terraform configurations which allows orchestrating of dependent layers, update arguments dynamically and keep configurations DRY.

Environments

Primary AWS region for all environments is eu-central-1 (Frankfurt):

  • acme-prod - Production configurations (AWS account - 111111111111)

  • acme-staging - Staging configurations (AWS account - 444444444444)

  • acme-master - Master AWS account (333333333333) contains:

    • AWS Organizations
    • IAM entities (users, groups)
    • ECR repositories
    • Route53 zones

Pre-requirements

If you are using macOS you can install all dependencies using Homebrew:

$ brew install terraform terragrunt pre-commit

Configure access to AWS account

Acme has dedicated AWS account where IAM users, groups and roles managed. This AWS account is a jump account, where IAM users logged in, and then they assume role in other AWS account.

The recommended way to configure access credentials to AWS account is using environment variables:

$ export AWS_DEFAULT_REGION=eu-west-1
$ export AWS_ACCESS_KEY_ID=...
$ export AWS_SECRET_ACCESS_KEY=...

Alternatively, you can edit terragrunt.hcl and use another authentication mechanism as described in AWS provider documentation.

aws-vault, vaulted, awsp or other tool can be used to manage your AWS credentials securely locally and switch roles.

Create and manage your infrastructure

Infrastructure consists of multiple layers (vpc, alb, ...) where each layer is described using one Terraform module with inputs arguments specified in terragrunt.hcl in respective layer's directory.

Navigate through layers to review and customize values inside inputs block.

There are two ways to manage infrastructure (slower&complete, or faster&granular):

  • Region as a whole (slower&complete). Run this command to create infrastructure in all layers in a single region:
$ cd acme-prod/eu-central-1
$ terragrunt apply-all
  • As a single layer (faster&granular). Run this command to create infrastructure in a single layer (eg, vpc):
$ cd acme-prod/eu-central-1/vpc
$ terragrunt apply

After you confirm the creation of the infrastructure should succeed.

If you want to suppress irrelevant output produced by Terragrunt, you can install this alias in your shell (source to gist):

terragrunt () {
	local action=$1
	shift 1
	command terragrunt $action "[email protected]" 2>&1 | sed -E "s|$(dirname $(pwd))/||g;s|^\[terragrunt\]( [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})* ||g;s|(\[.*\]) [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|\1|g"
}

References

Author

This project is created and maintained by Anton Babenko.

Maintained by Anton Babenko @antonbabenko

License

All content, including Terraform AWS modules used in these configurations, is released under the MIT License.

Copyright (c) 2019-2020 Anton Babenko

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].