It’s been some time since the latest Terramate CLI release in November last year. We worked hard to implement major performance and UX improvements to Terramate and are proud to announce Terramate v0.4.4 in this blog
Terramate Scripts
When using Terramate CLI, you often encounter scenarios where you want to execute a sequence of commands in stacks. A typical sequence for a Terraform deployment is:
terraform init
terraform validate
tfsec .
terraform apply -auto-approve
Terramate Scripts allow you to configure sequences of commands and execute them in a single call, e.g., terramate script run
. You do not need to remember the sequence and can not forget a command, whether you run the script in CI/CD or on your local machine.
script "deploy" {
description = "Run a Terraform deployment"
job {
commands = [
["terraform", "init"],
["terraform", "validate"],
["tfsec", "."],
["terraform", "apply", "-auto-approve"],
]
}
}
The above-configured script could be invoked in stacks using the scripts run
command, e.g.:
terramate script run deploy
Terramate scripts can be used to configure and abstract common complex scenarios, such as running a chain of commands in stacks. Please see the documentation to dive deeper and understand all possibilities and use cases of stacks.
Stack Filter
Conditional code generation in Terramate just became a lot easier and faster. The new implementation stack_filter
can be used to improve the performance and readability of code when conditionally generating code for stacks.
stack_filter {
project_paths = [
"/path/to/specific/stack", # match exact path
"/path/to/some/stacks/*", # match stacks in a directory
"/path/to/many/stacks/**", # match all stacks within a tree
]
}
For details on how to use stack filters in code generation, such as generate_hcl
please see the documentation.
Summary
Besides stack filters and scripts, we also promoted a bunch of commands from the experimental to the stable namespace, launched a new documentation website that is now much more complete and added better debugging instructions to Terramate.
As always, for a complete overview of all changes in v0.4.4, please see the CHANGELOG.
Join the Community
Your feedback is very valuable for us and the future development of Terramate. We’d love you to join our Discord Community, which is the best way to give us feedback or ask questions regarding Terramate. Only with your feedback can we continue improving Terramate and make sure that we help you manage Infrastructure as Code efficiently at any scale!