How to configure Terraform parallelism in Spacelift stacks
Last updated: September 15, 2025
You can control Terraform's parallelism behavior in Spacelift stacks by setting specific environment variables. This allows you to optimize the performance of your Terraform operations by controlling how many operations run concurrently.
Setting up parallelism
To configure parallelism for your Terraform operations, set the following environment variables in your stack configuration:
TF_CLI_ARGS_apply- Controls parallelism forterraform applyoperationsTF_CLI_ARGS_plan- Controls parallelism forterraform planoperations
Set both variables to -parallelism=<number> where <number> is your desired parallelism level. For example, to set parallelism to 80:
TF_CLI_ARGS_apply = -parallelism=80TF_CLI_ARGS_plan = -parallelism=80
Where to configure these variables
You can set these environment variables in two ways:
Directly in your Stack Settings
Through reusable contexts that are associated with your stack
For detailed instructions on setting environment variables, refer to the Spacelift environment configuration documentation.
Compatibility with spacectl
These parallelism settings will also be respected when you initiate deployments using the spacectl tool, as long as the environment variables are properly configured in your stack configuration or associated contexts.