[FEATURE] Run terramate run on specifed stack
donovanrost opened this issue · comments
Is your feature request related to a problem? Please describe.
I find it frustrating to have to switch directories to terramate run
in different stacks. I frequently need to apply changes to a number of environments in succession. I recognize that this should be automated in CI, but we aren't quite there yet.
Describe the solution you'd like
I would like, from any directory, to:
terramate run --stack <stackname> terraform apply
I currently find myself doing:
terramate run terraform apply
cd ../../../a/second/stack
terramate run terraform apply
cd ../../../a/third/stack
terramate run terraform apply
- and so on.
It would be nice to specify the specific stack from an arbitrary directory under the root.
Additional context
I recognize that this is a problem solved with CI, but when making changes at the module level API level, I like the fast feedback on whether or not I'm making a breaking change.
I think you can specify option --chdir. It will run in all stacks under specified directory.
Example: terramate run --chdir second/stack -- terraform apply
Additionally to what @worawatwi said, you can use --no-recursive
to not recurse into child stacks:
$ terramate run -C stacks/my-stack --no-recursive -- terraform plan
does this solve your problem?
For sure we can make this more convenient though.
Thanks @worawatwi @i4ki
@donovanrost thanks for flagging this. The run
command as well as others are properly documented as well. Please find the docs at https://terramate.io/docs/cli/cmdline/run#examples.
Please let us know if this answers your question! Thank you
This absolutely does answer the question. I think the confusion for me arose from:
terramate run -h
Usage: terramate run ...
Run command in the stacks
Arguments:
... Command to execute
Flags:
-h, --help Show context-sensitive help.
--version Terramate version
-C, --chdir=STRING Sets working directory
-B, --git-change-base=STRING Git base ref for computing changes
...
It wasn't clear from the usage what this was intended for. It is of course more clearly document in the documentation
Thanks for the feedback @donovanrost! We will update the CLI to match the docs and make this more clear
Thank you @soerenmartius. You guys are doing a great job. Terramate is really growing on me
Thank you @soerenmartius. You guys are doing a great job. Terramate is really growing on me
Thanks! I'd actually love to learn more about your use-case - perhaps we could schedule a call sometime? Thank You!