Stacks v2 is here! π
New features
- Stacks is now a command-line interface, with the following subcommands:
stacks render
: renders the layer in your working directory.stacks terraform
: wraps Terraform withstacks render
so you can do things likestacks terraform plan
.stacks diff
: compares a layer's rendered output atHEAD
vs. your current uncommitted changes.stacks encrypt/decrypt
: encrypts/decrypts a string.stacks surgery list/import/remove/move/rename/edit
: group of commands to simplify Terraform state operations.- ...and a couple others for advanced debugging, you shouldn't need them but read the code if interested.
- Added support for common Terraform code that's shared accross all layers.
- Added support for subenvironments (details in docs).
- Added support for Jinja-rendered variables in
*.tfvars.jinja
files at all levels of hierarchy. stack.tfvars
can now be<anything you want>.tfvars
, also applies tocommon.tfvars
andlayer.tfvars
. Precedence is attributed by alphabetical order (z.tfvars
overridesa.tfvars
).- Added the
stacks_environments
magic variable with the full list of environments and their variables. - Added these Jinja filters to facilitate cross-layer value retrieval (read docs for usage details):
{{ variable("foo", stack="bar") }}
: read another layer's variable.{{ output("foo", instance="bar") }}
: read another layer's output in state.{{ resource("aws_ec2_instance.main", stack="foo")["id"] }}
: read another layer's resource attributes.
- Added a
{{ throw(message) }}
Jinja filter to enable halting execution if Jinja-based value validation doesn't pass. - Documented all-of-the-above and more under
docs/
.
Breaking changes
- Terraform code is no longer allowed in layer directories: all code must now live in the stack base.
*.jinja.tfvars
files must now be named*.tfvars.jinja
for them to be read.- Removed the
terraform_remote_state_all_layers
,safe_terraform_remote_state
,terraform_remote_state
andterraform_local_state
Jinja filters: use the newvariable
,output
andresource
ones instead. - Removed all AWS-specific logic such as S3 state backend and AWS provider injection.
- Removed support for Jinja in modules.
Other
- Upgraded to Python 3.10.
- Implemented
uv
for package management. - Implemented
ruff
for linting and formatting.