I’m opening this thread with the hope that the terraspace team understands how close they are to providing a perfect, simple, powerful framework for terraform.
If you could implement these 2 features there will be no look back for any infra engineer out there.
Here they are:
The first feature is to provide the ability to define global resources easily and intuitively.
At the moment when we need to define global resources such as route53 or networks (in gcp) the only weapon we have in our arsenal is to create “global” stacks and map them to a specific env (
TS_ENV=global) then, allow the stacks only when we run terraspace with that variable set.
With the above approach, we have a few limitations that would make the feature not feasible to use.
Since we are centralizing global stacks into a specific ENV we would be unable to re-use the output in other regions / envs, making it impossible to create regional sub-resources that depends on the global resource.
TS_ENV=dev terraspace all upwould not work
We are forced to create a specific stack that will be considered “global” hiding implementation details
To make this essential feature work properly I would suggest the following:
Allow a subfolder within a stack named
global(conventional name) where it behaves like a normal stack, with the difference that will be automatically the parent dependency of the stack that is present in.
terraspace buildall the
globalfolders in each stack will be processed and added top level, next to the regional folders
terraspace all upthe global folders will be always applied first, keeping the dependency graph as normal, for example a global resource might still be a dependency of another global resource.
We need to be able to reference the output of the global resource within the regional stacks something like:
This would unlock amazing patterns such as creating a db instance hard-coding a specific region and referencing the IP in all other regions (removing the need to have multi-stack outputs).
It would allow us to easily manage the truly global resources and be intuitive.
Issue Ref: How to create "global" stacks - #2 by fenos
This is also a very high demanded feature from the community.
Currently, the nested structure is not supported which forces us to bloat the top-level stacks folder making it very hard to reason about when the project grows
We would like to be able to define nested stacks within a stack, and follow these rules:
Nested stacks will be automatically a dependency of the parent stack, (with the exception of the
globalfolder mentioned above)
terraspace all upthe nested stacks would use the same remote terraform state file instead of creating a separate one
- The biggest use case is to be able to de-clutter the stacks folder when the project is growing substantially, ultimately achieving a DRY and simple structure to follow.
Ref: Nested Stack Folders
I believe that the global resources management is one of the most important features that is missing. Nowadays cloud providers are abstracting lots of infrastructures to be globally available.
In one way or another, we’ll always encounter these kinds of resources.
Thanks a lot for making terraspace, it is a super awesome framework.