New To Terragrunt. Question about passing in aws_region as input and picked up by the root terragrunt.hcl


I have been using Terraform for awhile now. I recently started looking into terragrunt a bit more and been looking at this example.

I have a terraform.tfvars.json file with aws_region defined. Is there a way to reference this variable in the root terragrunt.hcl so that it can use it as part of the provider?

Apologies for the delay in responding here! In case this question is still relevant to you, you can achieve what you want by using jsondecode with file to load it into locals. E.g.,

locals {
  vars = jsondecode(file('/path/to/terraform.tfvars.json'))

Then, vars will contain the json data so you can reference the aws_region var using local.vars.aws_region.