Add an environment variable TF_VAR_spacelift_stack_slug
Currently we have TF_VAR_spacelift_stack_id, but since ID is not mutable we’d like another environment variable TF_VAR_spacelift_stack_slug that can be used to reference the stack name.
- Workaround
- No
- Problem
Log in to comment and vote
Comments2
Aquamarine Oak
Mar 9
@Danielle Murphy sorry, I did not realize there was a follow-up waiting for me! Apologies on the delay.
We excessively tag all resources deployed via Terraform, and one of the tag value we have is
workspace_name. This used to work well for us back when we were using Terraform Cloud from Hashicorp, because each deployment had its own workspace with a unique name. But in Spacelift each stack is entirely separate, and the workspace name is the default value, so we had changed that to TF_VAR_spacelift_stack_id when we migrated to Spacelift.This worked well, EXCEPT when we want to change the name of the stack. Because while you can change the slug you cannot change the ID, so the moment we change the “name” of the stack, TF_VAR_spacelift_stack_id no longer represents the visible name of the stack, which renders the tag less useful.
Danielle Murphy
Jan 21
Thanks for the request -at the moment, the stack “slug” and the stack ID are the same value in Spacelift, it is also technically possible to change the slug/id via GraphQL if required.
It would be helpful to understand:
What you would use
TF_VAR_spacelift_stack_slugfor?Why
TF_VAR_spacelift_stack_iddoesn’t work for that use case todayWith a bit more context, we can better assess whether a new environment variable is the right solution, or if there’s an existing or alternative mechanism that would fit the use case more cleanly.