Scalr
Scalr
July 6, 2023

New built-in variable adds logic to Custom Hooks

By
Alistair Heys

As of July 6 2023, Scalr has added a new built-in variable that can be used with Custom Hooks. The SCALR_RUN_IS_DESTROY  variable allows you to incorporate logic into your custom hook scripts, enabling you to differentiate between Terraform apply and Terraform destroy operations effortlessly.

How does it work? By analyzing the return code, you can easily determine the nature of the run. If the return code is 1, it means the run is equivalent to a Terraform destroy. Conversely, a return code of 0 indicates a Terraform apply. This valuable information empowers you to implement intelligent logic in your custom hook scripts, ensuring the right actions are triggered at the right time.

With Custom Hooks and SCALR_RUN_IS_DESTROY, you can automate pre- and post-run processes or customize actions based on specific environments. It's all about having the control to align your workflow with your requirements.

Incorporate Custom Hooks to leverage the power of SCALR_RUN_IS_DESTROY. You can remove manual adjustments by streamlining your personalized workflow that suits your needs.

Sign Up or Sign In to start using Custom Hooks!

Start using the Terraform platform of the future.

A screenshot of the modules page in the Scalr Platform