New Features
New Features
January 19, 2022

Chain Runs between workspaces using Run Triggers

Ryan Fee

Big news for Scalr users who have Terraform workspaces with a dependency on one another! Scalr has added an option to trigger a run in one workspace based on a successful run in another workspace.

No matter what kind of repository structure you have in place, it is generally best practice to break Terraform deployments out into smaller workspaces rather than a massive multi-thousand resource workspace. Smaller workspaces means quicker deployments and easier troubleshooting. This also means that workspaces are likely to have dependencies on one another. Perhaps your deployment components might need to follow a specific order, or your production workspace might need to kick off once your non-production workspace has successfully applied. This orchestration could be scripted today by calling the API or CLI, but why maintain extra code on top of what you have already done in Terraform.

Enter Scalr run triggers.

Run triggers are a way to chain workspaces together to build a greater orchestrated pipeline.

The way these triggers work is straightforward. The downstream workspace waits for one or more upstream workspaces to have a successful run. As soon as the apply is finished, the downstream run will be triggered. If your downstream workspace is linked to more than one upstream, then a run will be triggered based on a successful run of any upstream workspace.

Getting started is easy. Run triggers are available for everyone! The amount of triggers available to your account will depend on your tier: starter - 50, and  pro - 100 (soft limit). Simply go to one of your workspaces and add one or more upstream workspaces.

See the full documentation here.

Note: While this blog references Terraform, everything mentioned in here also applies to OpenTofu. New to OpenTofu? It is a fork of Terraform 1.5.7 as a result of the license change from MPL to BUSL by HashiCorp. OpenTofu is an open-source alternative to Terraform that is governed by the Linux Foundation. All features available in Terraform 1.5.7 or earlier are also available in OpenTofu. Find out the history of OpenTofu here.

Start using the Terraform platform of the future.

A screenshot of the modules page in the Scalr Platform