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.

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

before_apply

N

list<string>

List of commands executed before applying changes.

before_init

N

list<string>

List of commands executed before first interacting with the backend (eg. terraform init).

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 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)