Spacelift: Elevate Your Infrastructure Deployment
Spacelift Basics
Tasks
When working with Spacelift, there may be occasions when you need to run one-off Terraform commands—such as "terraform state list"—to troubleshoot issues or quickly gather important infrastructure details. This article explains how to execute these commands within Spacelift in a streamlined manner.
Tip
One-off commands can be especially useful when you need immediate feedback on the state of your infrastructure without altering your main configuration processes.
Running One-Off Terraform Commands
To execute a single Terraform command:
Navigate to the Tasks Section:
In the Spacelift dashboard, locate and click on the Tasks section. This is where you can input and run one-off commands.Execute Your Command:
Once you enter your desired Terraform command (for example,terraform state list
) and click "Perform," Spacelift will automatically spin up a container to handle the command execution. The resulting output is then displayed directly in the interface for your review.Review the Command Output:
The output provides real-time information about the current state of your infrastructure. For instance, runningterraform state list
might show entries for both an AWS instance and an AWS VPC, enabling you to quickly diagnose or verify the state of your deployments.
Below is a sample output demonstrating a successful one-off command execution:
[0m[32m[0161AZ1ZKRCFPHW9RCHMBOX] calculating state checksum...
[0m[32m[0161AZ1ZKRCFPHW9RCHMBOX] Running custom task with 0 custom hooks...
[0m[32m[0161AZ1ZKRCFPHW9RCHMBOX] Custom task performed successfully
[0m[32m[0161AZ1ZKRCFPHW9RCHMBOX] calculating state checksum...
Note
This facility not only helps in troubleshooting but also assists in gathering real-time state information without impacting your ongoing infrastructure operations.
Using one-off Terraform commands in Spacelift provides a quick and efficient method to inspect and diagnose your infrastructure, ensuring that you can address issues as they arise. For additional information on integrating Spacelift with Terraform workflows, refer to the Spacelift Documentation and Terraform Documentation.
Watch Video
Watch video content