Git Product home page Git Product logo

modules.tf-demo's Introduction

Infrastructure code for "Web App Reference Architecture (complete)"

This repository contains Terraform configuration files which were automatically generated from blueprint created using Cloudcraft.

Original infrastructure

Web App Reference Architecture (complete)


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

Table of Contents

  1. Quick start
  2. Configure access to AWS account
  3. Create and manage your infrastructure
  4. References
  5. About d2c.modules.tf

Quick start

  1. Install Terraform 0.15 or newer
  2. Install Terragrunt 0.29 or newer
  3. 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 terragrunt.hcl and use another authentication mechanism as described in AWS provider documentation.

Create and manage your infrastructure

Infrastructure consists of multiple layers (rds_2, rds_1, autoscaling_2, ...) 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 run-all apply
  • As a single layer (faster&granular). Run this command to create infrastructure in a single layer (eg, rds_2):
$ cd eu-west-1/rds_2
$ terragrunt apply

After the confirmation your infrastructure should be created.

References

About d2c.modules.tf

modules.tf is an open-source project created by Anton Babenko:

  1. Questions, bugs and feature-requests - open an issue.
  2. Become a sponsor to @antonbabenko.
  3. You are always welcome to share, star, like, tweet, follow!

@antonbabenko @antonbabenko modules.tf-lambda

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

modules.tf-demo's People

Contributors

antonbabenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

modules.tf-demo's Issues

When runt terragrunt nothing is created

I cloned https://github.com/antonbabenko/modules.tf-demo. following the instructions + video. When I run apply-all, S3 bucket is created, but no resources added.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Releasing state lock. This may take a few moments…
[terragrunt] [~/aws-tf/modules.tf-demo-master/web_app_reference_architecture_complete/eu-west-1/vpc] 2020/01/29 08:26:36 Detected 1 Hooks

[terragrunt] [~/aws-tf/modules.tf-demo-master/web_app_reference_architecture_complete/eu-west-1/vpc] 2020/01/29 08:26:36 Module ~/aws-tf/modules.tf-demo-master/web_app_reference_architecture_complete/eu-west-1/vpc has finished successfully!

I dont understand why nothing is created?

Credential Issue

I had Issue with credentials. If the key in common/main_providers.tf only export method works

2019/11/10 18:10:00 Create S3 bucket terraform-states-072717525149 returned an error: AccessDenied: Access Denied
	status code: 403, request id: 37AC6C10091FEAC5, host id: l3BbfEesPLDq8tNiE3F9rVeSO7fSMZpyz5VvHgMDTT0Ahj4xcOFXzKwYbrn/CIjLK8a2L8mW1Tw=. Sleeping for 10s and will try again.

Error thrown saying there's no output

Not sure what I'm doing wrong.

[terragrunt] 2020/01/15 15:54:07 /root/gdrive/slingshot/work/tf-infrastructure/sandbox/us-east-1/aws-data/terragrunt.hcl is a dependency of /root/gdrive/slingshot/work/tf-infrastructure/sandbox/us-east-1/vpc/terragrunt.hcl but detected no outputs. Either the target module has not been applied yet, or the module has no outputs. If this is expected, set the skip_outputs flag to true on the dependency block.
[terragrunt] 2020/01/15 15:54:07 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Could not find any subfolders with Terragrunt configuration files

image
When running:
terragrunt apply-all

[terragrunt] [/home/genaker/Downloads/Cloud-craft-former/cloud-craft_former/us-west-1] 2019/11/09 16:20:16 Running command: terraform --version
[terragrunt] 2019/11/09 16:20:16 Could not find any subfolders with Terragrunt configuration files
[terragrunt] 2019/11/09 16:20:16 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

How would i deploy to a second region?

Seeing that common/main_providers.tf references eu-west-1, if I create another folder on the same level as eu-west-1, would i need to make another common/main_providers.tf to reflect the second region?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.