Hi team, we have some stacks that we want to renam...
# atmos
t
Hi team, we have some stacks that we want to rename. They have a typo in them while other non-terraform code has the correct spelling and we want to fix it. The problem is: doing so seems to cause atmos to treat them as a different stack, and tries to create them fresh. We would like to avoid adding import blocks for this but we also don't have direct access to manually move the state files and so we need atmos to do it via our CI pipeline if possible because the stack name is used across multiple environments including production. Is there any way currently? I see this page talks about renaming components, but what about renaming stacks?
a
@Thomas Spear can you show an example of the stacks in YAML and what do you want to rename it to?
t
What part of the stack do you want to see specifically? It has some internal azure tags code I would need to redact at minimum. Some DNS and resource names too. I'd prefer to avoid sharing it. The issue is just a typo. The stack name is based on our internal app name and someone didn't know how to spell it correctly when it was first committed, and nobody caught the typo until later after some code on the Kubernetes side (where the spelling is correct) tried to reference the azure resources created from the terraform code (where the spelling is wrong), and ran into an error because of the discrepancy. So in this case, we want to change the word "feasability" in the stack name to "feasibility"
One of our cloud admins was able to use his permissions to look at the directories containing the terraform state files, and they all have the typo in them because the state file names are based on the atmos stack name.
a
stack name or component name? i don't need the internals, just to understand the structure
e.g., in a file
abc.yaml
:
Copy code
components:
  terraform:
    my-component-1: {}
t
Hello, @Andriy Knysh (Cloud Posse) apologies for the delay. In this case, the stack name is where the typo is located.
atmos terraform plan -s <stack-name-wif-typo> <component-name>
let's say the stack was actually named "stack-name-wif-typo" and "wif" is the typo: I want to make it "without"
a
let me take a look at this, I'll get back to you with some recommendations
t
Happy to mock up something on github to give you an example to work from.
a
please open an issue, will be faster and easier to create a doc