Ernyoke / ernyoke.github.io

Personal blog, and static website hosted on GitHub
http://ervinszilagyi.dev
1 stars 0 forks source link

https://ervinszilagyi.dev/articles/terragrunt-for-multi-region-multi-account-deployments.html #5

Open utterances-bot opened 2 weeks ago

utterances-bot commented 2 weeks ago

Ervin Szilágyi - Personal Site

https://ervinszilagyi.dev/articles/terragrunt-for-multi-region-multi-account-deployments.html

chos2205 commented 2 weeks ago

Hi Ervin, trying to command terragrunt run-all apply, but i am facing this issue: terragrunt.hcl:2,41-64: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a global.hcl in any of the parent folders of... Any idea?

Ernyoke commented 2 weeks ago

This is strange Terragrunt behavior, it cannot find global.hcl file in the root folder.

According to the documentation for find_in_parent_folders it says that is should be able to find configuration files in the same directory or in a parent directory of the current terragrunt.hcl file. Since both are present in the root folder, as per my understanding, it should be able to resolve them both. I assume this is a Terragrunt bug.

I suggest that you start deploying your code for one AWS account only, hence for one environment at the time. You could cd into one of these directories: dev, qa, prod and try to run execute run-all apply from there.

chos2205 commented 2 weeks ago

It seems a terragrunt bug I am in dev and executed run-all: WARN[0000] Error reading file ...tg-multi-account/dev/us-east-1/alb/../../_env/alb.hcl: open ...tg-multi-account/dev/us-east-1/alb/../../_env/alb.hcl: no such file or directory ERRO[0000] Error processing module at '...tg-multi-account/dev/us-east-1/alb/terragrunt.hcl'. How this module was found: Terragrunt config file found in a subdirectory of ...tg-multi-account/dev/us-east-1. Underlying error: open ...tg-multi-account/dev/us-east-1/alb/../../_env/alb.hcl: no such file or directory ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

chos2205 commented 2 weeks ago

terragrunt version 0.59.5

Ernyoke commented 2 weeks ago

Please try to do a git pull to get the latest changes from the repository.

chos2205 commented 2 weeks ago

Thank you!

chos2205 commented 2 weeks ago

Should it work(in Bold)?

Generate an AWS provider block

generate "provider" { path = "provider.tf" if_exists = "overwrite_terragrunt" contents = <<EOF provider "aws" { region = "${local.aws_region}" profile = "${local.environment}"

default_tags { tags = ${jsonencode(local.default_tags)} }

Only these AWS Account IDs may be operated on by this template

allowed_account_ids = ["${local.account_id}"] } EOF }

chos2205 commented 2 weeks ago

profile = "${local.environment}"