Spacelift
Purpose
Maps Spacelift stacks, spaces, policies, contexts, and integrations into SubImage so infrastructure-as-code orchestration can be correlated with the cloud resources it manages.
tip
Secret fields below accept either an AWS Secrets Manager ARN or a value pasted directly into SubImage's managed vault. See Secrets for details.
Required Fields
| Field | Secret? | Description |
|---|---|---|
spacelift_api_endpoint |
No | GraphQL endpoint, e.g. https://<your-account>.app.spacelift.io/graphql |
spacelift_api_key_id |
Yes | Spacelift API key ID. Required with spacelift_api_key_secret for the recommended API key authentication method. |
spacelift_api_key_secret |
Yes | Spacelift API key secret. Required with spacelift_api_key_id for the recommended API key authentication method. |
spacelift_api_token |
Yes | Advanced: pre-generated Spacelift JWT bearer token. |
Setup Steps
- In your Spacelift account, go to Organization settings → API keys and create a secret-based API key. See the Spacelift API key docs for the current Spacelift flow.
- Give the API key Reader access to the spaces you want SubImage to ingest. If your organization uses Spacelift login policies, make sure the API key is allowed by those policies too.
- Save the downloaded API key file. Spacelift only shows these values once. The file includes:
api_key_idapi_key_secret- a token snippet for Terraform module access
- Your GraphQL endpoint is
https://<your-account>.app.spacelift.io/graphql. - In SubImage, fill in:
spacelift_api_endpoint— your GraphQL endpointspacelift_api_key_id— the API key ID, or an AWS Secrets Manager ARN / SubImage-managed secret containing itspacelift_api_key_secret— the API key secret, or an AWS Secrets Manager ARN / SubImage-managed secret containing it
- Leave
spacelift_api_tokenblank. - Save the module. Cartography will use the API key ID and secret to obtain Spacelift API tokens during sync.
Advanced: Pre-generated JWT Token
Use spacelift_api_token only if you already have a Spacelift API token and want SubImage to use it directly.
Exchange the API key ID and secret for a Spacelift API JWT token.
- In the Spacelift UI, use
https://<your-account>.app.spacelift.io/apikeytoken. - Or make a GraphQL request to
https://<your-account>.app.spacelift.io/graphql:
mutation GetSpaceliftToken($id: ID!, $secret: String!) { apiKeyUser(id: $id, secret: $secret) { jwt } }with variables:
{ "id": "<api_key_id>", "secret": "<api_key_secret>" }- In the Spacelift UI, use
In SubImage, fill in:
spacelift_api_endpoint— your GraphQL endpointspacelift_api_token— the JWT token, or an AWS Secrets Manager ARN / SubImage-managed secret containing the JWT token
Leave
spacelift_api_key_idandspacelift_api_key_secretblank.Save the module.
Notes
- Configure exactly one authentication method: either
spacelift_api_key_idplusspacelift_api_key_secret, orspacelift_api_token. - The recommended API key ID and secret flow matches Spacelift's long-term API authentication guidance and lets Cartography handle token generation during sync.
- The advanced
spacelift_api_tokenvalue should look like a JWT with three dot-separated parts. A downloaded API key file, anapi:<id>:<secret>string, an API key ID, or an API key secret by itself will not work in this field.