addo-demo
addo-demo copied to clipboard
All code used during my All Day DevOps talk
Infrastructure code for "addo-demo"
This repository contains infrastructure as Terraform configurations which were automatically generated from blueprint created using cloudcraft.co.
Terragrunt is used to work with Terraform configurations which allows to orchestrate dependent layers, update arguments dynamically and keep configurations DRY.
Table of Contents
- Quick start
- Configure access to AWS account
- Create and manage your infrastructure
- References
- About modules.tf
Quick start
- Install Terraform 0.12 or newer
- Install Terragrunt 0.19 or newer
- Optionally, install pre-commit hooks to keep Terraform formatting and documentation up-to-date.
If you are using macOS you can install all dependencies using Homebrew:
$ brew install terraform terragrunt pre-commit
Configure access to 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 common/main_providers.tf
and use another authentication mechanism as described in AWS provider documentation.
Create and manage your infrastructure
Infrastructure consists of multiple layers (autoscaling, s3-bucket, 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 eu-west-1
$ terragrunt apply-all
-
As a single layer (faster&granular). Run this command to create infrastructure in a single layer (eg,
autoscaling
):
$ cd eu-west-1/autoscaling
$ terragrunt apply
After the confirmation your infrastructure should be created.
References
- Terraform documentation and Terragrunt documentation for all available commands and features.
- Terraform AWS modules.
- Terraform modules registry.
About modules.tf
modules.tf is an open-source project by Anton Babenko, and, yes, you can contribute, too:
- Questions, bugs and feature-requests - open an issue.
- Become a sponsor to @antonbabenko.
- You are always welcome to share, star, like, tweet, follow!
All content, including Terraform AWS modules used in these configurations, is released under the MIT License.