Spacelift
Configure Campaigns Agent for Spacelift state backend
The Campaigns Agent needs:
A Spacelift API token in the environment variable
SPACELIFT_API_TOKEN
in order for the agent to access the state. To get an API token in the Spacelift UI, navigate to Organization Setting > API keys > Create API Key. This will give you a credentials file that looks something like this:
Please use the following API secret when communicating with Spacelift
programmatically:
SECRET_VALUE
Please add this snippet to your .terraformrc file if you want to use this API
key to access Spacelift-hosted Terraform modules outside of Spacelift:
credentials "spacelift.io" {
token = "TOKEN_VALUE"
}
The key Campaigns Agent needs is the one inside the credentials "spacelift.io"
block. Set that value in the environment variable SPACELIFT_API_TOKEN
.
The Spacelift workspace to have "External state access enabled" Follow the instructions here to toggle this setting.
Configure Spacelift state backend in .resourcely.yaml
The following block will configure a Spacelift state backend:
# Required
version: "2"
# Array of Terraform config roots that Resourcely should care about
terraform_config_roots:
-
name: basic
default_file: main.tf
path: .
skip: false
campaign_config:
state_file_config:
spacelift:
organization: <org>
workspace: <workspace>
Last updated