Giter VIP home page Giter VIP logo

terragrunt-reference-architecture's Introduction

Hi there, I'm Anton ๐Ÿ‘‹

Twitter Follow Your Weekly Dose of Terraform on YouTube Terraform Weekly Newsletter

I am AWS Community Hero and a founder of Betajob - a company that helps build solutions using AWS and specializes in infrastructure as code, DevOps, and reusable infrastructure components.

I like

Some of my open-source projects

Connect with me

antonbabenko.com antonbabenko | Twitter antonbabenko | LinkedIn antonbabenko | YouTube antonbabenko | Twitch weekly.tf

terragrunt-reference-architecture'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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

terragrunt-reference-architecture's Issues

Reference Workflow

Do you have any suggestions for what a work flow would look like for the developers interacting with a repository following the same structure as this repository?

Things that would be interesting to understand your opinion on:

  1. What would an automated pipeline look like for this repository?
  2. Would a PR be able to sufficiently serve as the 'manual approval's step for each PR made to this infrastructure?
  3. What steps would be necessary to deploy a change to one of the base modules to all of the environments (how many PRs, how would you validate the change as it is deployed to each environment)?

Clarify the VPC portion in acme-prod

In acme-prod/eu-central-1 is a folder to create the VPC. If I have two regions and in this example there's a us-east-1 region, would I need to create a vpc folder w/ the same code in the us-east-1 folder? if so, I thought terragrunt is supposed to allow you to have DRY code?

Strange output with the Terragrunt alias

I was using this

terragrunt () {
	local action=$1
	shift 1
	command terragrunt $action "$@" 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"
}

to get nice output, but what I have noticed you can see below

terragrunt apply

... 

Plan: 1 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

yes
  Enter a value:
google_project_iam_member.cluster_service_account-resourceMetadata-writer[0]: Creating...
google_container_cluster.primary: Modifying... [id=gke-cluster]

As you can see I have to type the answer and only after the answer you can see the expected field Enter a value:

Problem loading configurations from a parent directory

This file uses commands to load common.tfvars and regional.tfvars

However, it seems to have a problem loading this common.tfvars in when it runs, saying it can't find common.tfvars.

Call to function "find_in_parent_folders" failed

I just tried navigating into the region level directory under the "parent" terragrunt.hcl file.
It errored out and no detail on error, just this

time=2021-04-16T12:39:14-05:00 level=error msg=Encountered the following errors:
Hit multiple errors:
Hit multiple errors:
exit status 127

It also generated a backend file in the "parent" directory that has the common variables, but is not the individual region's section.

When I copied the debug command output and run the command below it plans fine.

terraform plan -var-file="/Users/sheldonhull/git/repo/terragrunt/staging/eu-central-1/vpc/terragrunt-debug.tfvars.json" "/Users/sheldonhull/git/repo/terragrunt/staging/eu-central-1/vpc/.terragrunt-cache/QaAhZIo4_imktYigJ0DeKyQKkDk/ky_VpYadOztK_rvSkFtkAnFs6aY/modules/vpc"

This is a bit confusing as new terragrunt user.
I'm not seeing the native terraform commands exposed easily to know what happened, it's just outputting the terraform help content.

The error doesn't even show the actual terraform init/plan command, just this:


DEBU[0001] Run this command to replicate how terraform was invoked:  prefix=[/Users/sheldonhull/git/repo/terragrunt/staging/eu-central-1/vpc]
DEBU[0001] 	terraform  -var-file="/Users/sheldonhull/git/git/repo/terragrunt/staging/eu-central-1/vpc/terragrunt-debug.tfvars.json" "/Users/sheldonhull/git/terragrunt/staging/eu-central-1/vpc/.terragrunt-cache/QaAhZIo4_imktYigJ0DeKyQKkDk/ky_VpYadOztK_rvSkFtkAnFs6aY/modules/vpc"  prefix=[/Users/sheldonhull/git/repo/terragrunt/staging/eu-central-1/vpc]
panic: runtime error: index out of range [0] with length 0

goroutine 19 [running]:
github.com/gruntwork-io/terragrunt/options.(*TerragruntOptions).InsertTerraformCliArgs(0xc000365dc0, 0x2848b78, 0x0, 0x0)
	github.com/gruntwork-io/terragrunt/options/options.go:296 +0x37c
github.com/gruntwork-io/terragrunt/cli.runTerragruntWithConfig(0xc0003b4700, 0xc000365dc0, 0xc000894000, 0x0, 0xf, 0x0)
	github.com/gruntwork-io/terragrunt/cli/cli_app.go:620 +0xae
github.com/gruntwork-io/terragrunt/cli.RunTerragrunt(0xc0003b4700, 0x5, 0x1f21e28)
	github.com/gruntwork-io/terragrunt/cli/cli_app.go:474 +0x85c
github.com/gruntwork-io/terragrunt/configstack.(*runningModule).runNow(0xc0002e8820, 0xc000149f5f, 0x0)
	github.com/gruntwork-io/terragrunt/configstack/running_module.go:243 +0x185
github.com/gruntwork-io/terragrunt/configstack.(*runningModule).runModuleWhenReady(0xc0002e8820, 0xc0000a83c0)
	github.com/gruntwork-io/terragrunt/configstack/running_module.go:206 +0xd5
github.com/gruntwork-io/terragrunt/configstack.runModules.func1(0xc00088a410, 0xc0000a83c0, 0xc0002e8820)
	github.com/gruntwork-io/terragrunt/configstack/running_module.go:172 +0x5d
created by github.com/gruntwork-io/terragrunt/configstack.runModules
	github.com/gruntwork-io/terragrunt/configstack/running_module.go:170 +0x11b

Directory Structure

.                                                                                                   
โ”œโ”€โ”€ README.md                                                                                       
โ”œโ”€โ”€ Taskfile.yml                                                                                    
โ”œโ”€โ”€ modules
โ”‚   โ”œโ”€โ”€ aws-data
โ”‚   โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”‚   โ”œโ”€โ”€ main.tf
โ”‚   โ”‚   โ”œโ”€โ”€ outputs.tf
โ”‚   โ”‚   โ””โ”€โ”€ versions.tf
โ”‚   โ””โ”€โ”€ vpc
โ”‚       โ”œโ”€โ”€ README.md
โ”‚       โ”œโ”€โ”€ label.tf
โ”‚       โ”œโ”€โ”€ outputs.subnets.tf
โ”‚       โ”œโ”€โ”€ outputs.vpc.tf
โ”‚       โ”œโ”€โ”€ variables.common.tf
โ”‚       โ”œโ”€โ”€ variables.stack.tf
โ”‚       โ”œโ”€โ”€ versions.tf
โ”‚       โ””โ”€โ”€ vpc.tf
โ”œโ”€โ”€ terragrunt
โ”‚   โ””โ”€โ”€ staging     <<<<<<<<<<< THIS IS MY WORKING DIRECTORY, running terragrunt from this context
โ”‚       โ”œโ”€โ”€ Taskfile.yml
โ”‚       โ”œโ”€โ”€ common.tfvars  <---- NEVER SEES TO FIND THIS
โ”‚       โ”œโ”€โ”€ eu-central-1   <---- navigating into this subdirectory and running doesn't change it's ability to find the common.tfvars
โ”‚       โ”‚   โ”œโ”€โ”€ regional.tfvars
โ”‚       โ”‚   โ””โ”€โ”€ vpc
โ”‚       โ”‚       โ”œโ”€โ”€ terragrunt-debug.tfvars.json
โ”‚       โ”‚       โ””โ”€โ”€ terragrunt.hcl
โ”‚       โ”œโ”€โ”€ global  <---- not doing anything with it, they are all commented out for now
โ”‚       โ”‚   โ”œโ”€โ”€ iam-account
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ terragrunt.hcl
โ”‚       โ”‚   โ”œโ”€โ”€ iam-assumable-roles
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ terragrunt.hcl
โ”‚       โ”‚   โ””โ”€โ”€ regional.tfvars
โ”‚       โ””โ”€โ”€ terragrunt.hcl  <---- what i'm calling "ROOT" so I can "run-all" against all the pieces in this stack

Does this actually work?

I noticed the terragrunt.hcl file is missing. Not sure how to properly use this repo as a reference.

The terragrunt function wrapper is not compatible with the later versions of Terragrunt

terragrunt () {
	local action=$1
	shift 1
	command terragrunt $action "$@" 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"
}

The problem is that with any command which requires input, it never comes up.

Example:

terragrunt run-all apply
time=2021-12-04T14:55:46Z level=info msg=The stack at uat will be processed in the following order for command apply:
Group 1
- Module uat/network

Group 2
- Module uat/ecs_service

I'm not actually sure what the fix would be... but basically, it's now showing Are you sure you want to run 'terragrunt apply' in each folder of the stack described above? (y/n) until you actually enter y or n

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.