Skip to content

Local Spacelift Run: Leveraging Context and Environment Variables

Can we execute a Spacelift (formerly Terraform Cloud) run with locally sourced files while retaining the full context, including environment variables? Here’s how you can preview uncommitted local changes using Spacectl.

How to Preview Local Changes in Spacelift:

To inspect your modifications without committing them directly into a stack on Spacelift (now part of Hashicorp), utilize the local-preview subcommand from spacectl, which is accessible here: Spacectl.

spacectl stack local-preview --id <STACK ID>

Replace <STACK ID> with your actual Spacelift (or Hashicorp Terraform Cloud now managed by Spacectl’s predecessors, tfc) stack identifier. This command will allow you to test the application of changes within a local preview against existing resources defined in space-managed infrastructure as code – all while retaining environmental context and variable values used during your initial Spacelift configuration or runbook execution on their platform.

Additional Resources:

For further assistance with Spacectl, refer to these guides provided by the relevant community documentation teams who oversee spacetest tools like spacectl:

By leveraging local-preview, you maintain the power of your infrastructure as code principles locally and efficiently previews changes before they are applied to a live environment in space or on Spacelift at scale – an essential feature for iterative development, testing workflows within CI/CD systems.


Previous Post
Understanding Deployment vs Container Readiness Pr
Next Post
Including Large Files in a Helm ConfigMap