Skip to content
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] Use Clone feature to overwrite stacks, but keeping stack IDs. #1779

Open
solovyevt opened this issue Jun 27, 2024 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@solovyevt
Copy link

solovyevt commented Jun 27, 2024

Is your feature request related to a problem? Please describe.
One convenient use-case for Clone feature is to promote environment stack, e.g. staging -> prod, but currently it's not possible due to one-time nature of terramate clone.

Describe the solution you'd like
A useful improvement would be a --sync or --destructive flag that will allow to run terramate clone on existing folders and synhcronize everything, but keeping stack.id field intact.

Describe alternatives you've considered
I've been using a custom script that did the following:

  1. Parse the stack.id field, store in a variable
  2. Remove existing target directory
  3. Run terramate clone
  4. Set stack.id field

Additional context
It might be wise to think about additional field that would be preferable to store, e.g. stack.description or stack.name, but I will leave this to maintainers.

P.S. Thank you for your great work.

@solovyevt solovyevt added the enhancement New feature or request label Jun 27, 2024
@soerenmartius
Copy link
Contributor

Thanks for suggesting this! We were actually thinking about similar use-cases. Let me discuss this with the team and get back to you!

@i4ki
Copy link
Contributor

i4ki commented Jun 28, 2024

What is the difference between terramate clone keeping all stack ids intact and plain cp -R from/stacks to/stacks ?

@solovyevt
Copy link
Author

solovyevt commented Jul 1, 2024

@i4ki Currently terramate clone can be executed if the target folder does not exist, so it copies the source stack and it's nested stacks and generates new IDs.

Now, the requested feature should allow to execute terraform clone even if the target folder exists, and, naturally, you would want for the current target stack IDs to be preserved, while all other content is overwritten with the contents of the source stack.

@kaiehrhardt
Copy link

Feels more like a new subcommand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants