Hi there, like many others, I’d like to thank you for this amazing tool. I love how easy it is to use to create your boilerplate framework of terraform config as well being so easy to setup environments. Which leads me to my question.
I have been primarily working on my TS_ENV=dev stacks environment and its been working great!
I am now at a point where I want to initialize my TS_ENV=prod stack environment. Question here is that with the way I setup my stacks, its trying to provision some global resources again such as Route53 to be more specific.
Is there a method to instantiate these global resources so they are not done on a per environment level? Or an ignore env X,Y,Z for this stack?
I see another discussion about the terraspace up all command and to configure your app.rb to handle it. Wondering if we can say that only prod can call X stack? I tried to move my global resources into a global stack name to configure it this way, but its only handled now via the up all command but not calling the stack directly.
Also, made a BoltOps Learn video. Consider getting a subscription or asking your company. Trying to figure out ways to be able to work and improve Terraspace more. No sweat either way of course. Thanks!
Note: In digging into this, released terraspace 1.0.4 and updated the option to config.all.exclude_stacks. The config.all.ignore_stacks still works but you’ll receive a deprecation warning.
I see! Was wondering why the raise in ERB was ok to use, as it won’t work with terraspace all.
The aim here is to restrict certain stacks from being deployed with certain TS_ENV environments for terraspace up. The config.all related options were being conflated, at least in my mind. Think get it now, though. Thanks for kindly pointing out that difference.
Okay, dugged into it. Believe tackled it in this PR and Docs:
Added the ability to control which stacks are allowed to be deployed. Believe this will work for what you’re trying to achieve:
Terraspace.configure do |config|
if Terraspace.env == "global"
config.allow.stacks = ["route53"]
config.deny.stacks = ["route53"]
The docs cover more examples. If your logic gets more complex, consider the multiple file approach in the docs.
Implemented config.allow.stacks and config.deny.stacks in a way so that it’s used by terraspace up and also by terraspace all. So folks only have to set it one time. Happy with how that turned out.
Note: The config.ENV.exclude_stacks can be achieved with config/envs/ENV.rb already. Got mixed feelings about the config.ENV.exclude_stacks notation. Leaning on not adding it and sticking with only config/envs/ENV.rb right now.