0

I am trying to access variables from variables.tf file inside terragrunt.hcl file.

Project structure:

| Terraform
    | shared-folder
        - variables.tf
    -vars.tf
    -terragrunt.hcl

This is the code snippet from .hcl file

locals{
    
    account_vars = "${get_parent_terragrunt_dir()}/variables.tf"
    
    env = local.account_vars.locals.account_name
    
}

remote_state {
  backend = "s3"
  config = {
    bucket         = get_env("STATEFILE_BUCKET", "terragrunt-${get_aws_account_id()}-statefiles")
    key            = "jsworld/state/jsTutorial-${local.env}.tfstate"
  }
}

variables.tf

locals {
  account_name   = "devl"
}

How can I access this into .hcl file

Gaurav Takte
  • 607
  • 5
  • 22

1 Answers1

0

This is not how Terragrunt works. Terragrunt is able to instantiate TF variables and pass values into Terraform and to read the outputs from Terraform.

Bernard Halas
  • 972
  • 11
  • 24