Skip to content

Announcing Enhanced VCS Integration 🎉 🎉

Read more here →

YAML reference»

This document is a reference for the Spacelift configuration keys that are used in the .spacelift/config.yml file to configure one or more Stacks.

Warning

The .spacelift/config.yml file must be located at the root of your repository, not at the project root.

Stack settings»

Module settings»

version»

The version property is optional and currently ignored but for the sake of completeness you may want to set the value to "1".

stack_defaults»

stack_defaults represent default settings that will apply to every stack defined in the id-settings map. Any default setting is overridden by an explicitly set stack-specific value.

Key Required Type Description
after_apply N list<string> List of commands executed after applying changes.
after_destroy N list<string> List of commands executed after destroying managed resources.
after_init N list<string> List of commands executed after first interacting with the backend (eg. terraform init).
after_perform N list<string> List of commands executed after performing a custom task
after_plan N list<string> List of commands executed after planning changes
after_run N list<string> List of commands executed after every run, regardless of its outcome
before_apply N list<string> List of commands executed before applying changes.
before_destroy N list<string> List of commands executed before destroying managed resources.
before_init N list<string> List of commands executed before first interacting with the backend (eg. terraform init).
before_perform N list<string> List of commands executed before performing a custom task
before_plan N list<string> List of commands executed before planning changes
environment N map<string, string> Map of extra environment variables and their values passed to the job
project_root N string Optional folder inside the repository serving as the root of your stack
runner_image N string Name of the custom runner image, if any
terraform_version N string For Terraform stacks, Terraform version number to be used

stacks»

The stacks section is a map using stack public ID (slug) as keys and stack settings - described in this section - as values. If you're using this mapping together with stack defaults, note that any default setting is overridden by an explicitly set stack-specific value. This is particularly important for list and map fields where one may assume that these are merged. In practice, they're not merged - they're replaced. If you want merging semantics, YAML provides native methods to merge arrays and maps.

module_version»

Module version is a required string value that must conform to the semantic versioning scheme. Note that pre-releases and builds/nightlies are not supported - only the standard $major.$minor.$patch format will work.

test_defaults»

Test defaults are runtime settings following this scheme that will apply to all test cases for a module.

tests»

The tests section represents a list of test cases for a module, each containing the standard runtime settings in addition to the test-specific settings:

Key Required Type Description
name Y string Unique name of the test case
negative N bool Indicates whether the test is negative (expected to fail)
id N string Unique identifier of the test case which can be used to refer to the test case
depends_on N list<string> List of test case ids this test depends on