-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Command to get stack ID #1960
Comments
Do you orchestrate Terragrunt with Terramate? If so you could pass the Other than that, a potential workaround for now would be just to use For example, the following code generation snipped will generate the above mentioned approach: generate_file "metadata.json" {
content = tm_jsonencode({
stack_id = terramate.stack.id
})
} |
Something like this sounds like a good idea, especially taking into consideration that |
Yes, I'm using Can that snippet go in the main |
Terramate configuration files( For example, I would put the
import {
source = "/imports/*.tm.hcl"
} But that's just my personal preference :) |
Also don't forget to run |
The workaround you provided works! I added your block into my main locals {
# We read the stack ID from the file created by terramate
stack_id = try(jsondecode(file("${get_original_terragrunt_dir()}/metadata.json")).stack_id, "None")
} remote_state {
backend = "gcs"
config = {
# Every project will use a separate state bucket.
project = local.project_id
bucket = "${local.project_id}-tf-states"
location = "europe-west2"
prefix = local.stack_id
gcs_bucket_labels = {
project = local.project_id
name = "${local.project_id}-tf-states"
}
}
generate = {
path = "_backend.tf"
if_exists = "overwrite_terragrunt"
}
} |
Feature Request
I would like there to be a way of extracting the
stack
ID so it can be used in other parts of the IAC tool stack.Describe the solution you'd like
This could be done in different ways, either via a
terramate
command, or with the ability to write thestack.tm.hcl
file in a parseable format, likejson
oryaml
.Example via command flag:
Example via file:
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
I would like to adopt the state management approach introduced by
terramate
where state files are stored in a flat folder structure by stack ID, while also usingterragrunt
.The text was updated successfully, but these errors were encountered: