Skip to content

Is there support for var-file layering? #809

Answered by i4ki
az-z asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @az-z

There's no explicit support but you can achieve the same behavior using globals and terramate.config.run.env. Example below:

Let's say you have the tree below:

$ tree .
.
├── common.tfvars
├── others.tfvars
├── README.md
├── stack-a
│   └── terramate.tm.hcl
├── stack-b
│   ├── stack-b-1.tfvars
│   ├── stack-b-2.tfvars
│   └── terramate.tm.hcl
├── stack-c
│   ├── stack-c.tfvars
│   └── terramate.tm.hcl
└── terramate.tm.hcl

then in the /terramate.tm.hcl you add this configuration:

terramate {
  config {
    run {
      env {
        TF_CLI_ARGS = global.tf_cli_args
      }
    }
  }	
}

globals {
  hierarchy_parts = tm_split("/", terramate.stack.path.absolute)
  hierarchy_dirs = […

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mariux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants