Advanced Spacelift Interview Questions (2027)
36 advanced Spacelift interview questions: Rego policies and deprecations, stack dependencies, spaces, contexts, private workers, drift detection.
Advanced Spacelift interviews focus on design and operations: policies written in Rego and which policy types are now deprecated, stack dependencies and output references, spaces and contexts for multi-team setups, private worker pools and their networking, drift detection with reconciliation, and how runs move through their states. This page has 36 questions with direct answers, grouped by topic, plus scenarios.
These questions assume you already use Spacelift with Terraform or OpenTofu and want a senior or platform role. For the general set, start with the Spacelift engineer interview questions, then come back here. The 50 Spacelift interview questions post covers the middle ground.
Key takeaways
- Spacelift policies are written in Rego and run by Open Policy Agent. Spacelift supports Rego v0 and v1 and recommends v1 for new policies.
- Know which policy types are deprecated: initialization and task policies are replaced by approval policies, trigger policies are mostly replaced by stack dependencies, and access policies by space access control.
- Stack dependencies form a directed acyclic graph, respect only tracked runs, and pass outputs as environment variables.
- Drift detection works only on private workers and can trigger reconciliation runs.
- Private workers use MQTT by default, which Spacelift is sunsetting on 30 March 2027. HTTP long-poll is the recommended replacement, and the docs recommend switching by 1 January 2027.
How the questions are grouped
| Section | Questions | Focus |
|---|---|---|
| Runs and stacks | 1 to 6 | Run types, states, hooks |
| Policies | 7 to 14 | Policy types, Rego, deprecations, testing |
| Stack dependencies | 15 to 20 | Ordering, outputs, limits |
| Spaces, contexts and access | 21 to 25 | Multi-team structure and configuration reuse |
| Workers and drift | 26 to 30 | Private pools, networking, drift detection |
| Scenarios | 31 to 36 | Design and troubleshooting |
Runs and stacks
1. What run types does Spacelift have?
A proposed run previews the changes a code change would make. A tracked run is a deployment. A task is a freeform command run against a stack's infrastructure. A module test case runs tests for an OpenTofu or Terraform module. Many interview questions turn on the difference between proposed and tracked runs, because several features only respond to tracked ones.
2. Walk through the states of a tracked run.
Queued while it waits for a lock, approval or upstream stacks; Ready when a worker can take it; Preparing while the worker pulls the image and starts the container; Initializing for pre-init hooks and tool setup such as terraform init; Planning; Unconfirmed when the plan has changes awaiting review; Confirmed; Applying; and finally Finished. Other terminal states are Failed, Stopped, Discarded, Canceled and Skipped.
3. What does the Unconfirmed state tell you?
The plan contains changes and the stack is not set to apply automatically, so a person must review and confirm. Teams usually leave production stacks in this mode or use approval policies to formalise who can confirm.
4. How do pre-initialization hooks work, and when would you use one?
They run during the Initializing phase, before the tool's own initialisation, in the same shell session. Variables they export are visible to the init step, so they are a common place to fetch short-lived credentials from a secrets manager such as HashiCorp Vault.
5. Why are tracked and proposed runs treated differently by automation?
Proposed runs are previews with no effect on infrastructure, so they should not trigger downstream work. Tracked runs change real state, which is what dependent stacks, reconciliation and notifications care about. Stack dependencies, for example, ignore proposed runs and tasks completely.
6. Which settings are fixed when a dependent run is created, and which are read later?
The commit, runtime configuration and runner settings are fixed when the run is created. Environment variables, mounted files, contexts and cloud credentials are read when a worker picks up the run. So a context edited while a run waits in the queue will affect that run, while a new commit will not.
Policies
7. What language are Spacelift policies written in?
Rego, the language of the open source Open Policy Agent. Spacelift supports both Rego v0 and v1 and you can switch between them in the policy editor. The docs recommend v1 for all new policies because of its improved syntax and stricter semantics.
8. List the policy types and what each decides.
Login controls who can log in and with what access. Approval decides who can approve or reject runs. Plan gives feedback after planning and can block or warn. Push decides how Git push events are handled, such as tracking, proposing or ignoring. Notification routes and filters notifications. Intent controls resource operations in Intent projects. Access, initialization, task and trigger policies also exist but are deprecated or largely replaced.
9. Which policy types are deprecated, and what replaces them?
Initialization and task policies are deprecated in favour of approval policies. Trigger policies are mostly replaced by stack dependencies. Access policies have been replaced by space access control. Interviewers ask this to see whether you keep up with the product rather than repeating old blog posts.
10. When would you use a plan policy?
To check the planned changes against your rules: block destruction of protected resources, require tags, warn on large changes or restrict instance types. Plan policies see the plan, so they catch problems that static scans of the source cannot.
11. What is a push policy used for in a monorepo?
It decides which stacks react to a push, based on changed files, branches or labels. In a monorepo it stops every stack from running on every commit, so only stacks whose directories changed get proposed or tracked runs.
12. How would you require two approvals for production changes?
Write an approval policy attached to production stacks that approves a run only when at least two reviewers, possibly from a specific team, have approved, and rejects if anyone with authority rejects. Attach it with a label so new production stacks receive it automatically.
13. How do you test policies before attaching them?
Write Rego unit tests with sample inputs and run them with OPA's test runner, then attach the policy to a non-production stack first.
14. How do policies attach to many stacks without manual work?
Through labels. A policy labelled with autoattach: plus a label value attaches to every stack with that label, within the policy's space and the spaces that inherit from it.
Stack dependencies
15. What are stack dependencies?
A way to make one stack run only after another finishes, such as a database stack before the application stack that uses it. Dependencies form a directed acyclic graph; cycles are rejected. Independent stacks at the same level run in parallel.
16. Which runs do dependencies respect?
Only tracked runs. Proposed runs and tasks are ignored. When an upstream tracked run starts, downstream stacks queue and wait for it.
17. How are outputs passed between stacks?
With output references. An upstream output is exposed to the dependent stack as an environment variable; for Terraform, use the TF_VAR_ prefix so it becomes an input variable. By default the downstream stack triggers only when the referenced output is created or changed, unless you enable "Trigger always".
18. What happens when a run in a dependency chain fails?
The rest of that chain is cancelled. Stacks at the same level that do not depend on the failed one are not affected.
19. What are the gotchas with outputs?
Only outputs from a successful tracked run with an apply phase are used. Retries do not trigger dependents. Sensitive outputs need transfer enabled on the stack, and private pools also need SPACELIFT_SENSITIVE_OUTPUT_UPLOAD_ENABLED=true. Ansible and Kubernetes stacks have no outputs, so they can receive values but not provide them. Passing too many outputs can hit a 128 kB argument limit.
20. Should you combine stack dependencies with trigger policies?
No. The docs advise against it because the two mechanisms can confuse each other or create loops. Use dependencies for ordering and move away from trigger policies.
Spaces, contexts and access
21. What are spaces?
Groups of Spacelift resources, such as stacks, policies, contexts, modules, worker pools and cloud integrations, used to delegate limited admin rights to teams or environments. Every account has a root space and a legacy space for backward compatibility. Spaces can be nested into a tree.
22. How does space inheritance work?
Child spaces with inheritance can use resources from their parents, so a worker pool or VCS integration in a parent can serve every team below it, and an auto-attached policy can apply across the inheriting tree.
23. What is a context?
A reusable bundle of environment variables, mounted files and hooks that exists independently of any stack and can be attached to many stacks or modules. Secret values are hidden in the UI and API. Editing a context affects every project that uses it.
24. How is precedence decided when several contexts set the same variable?
Stack-level settings win, then explicitly attached contexts by priority (lower numbers apply first), then auto-attached contexts in alphabetical order.
25. How would you structure spaces for three product teams and shared infrastructure?
Put shared worker pools, integrations and baseline policies in a parent space. Create a child space per team with inheritance, and separate production and non-production either as child spaces or with labels and policies. Map identity provider groups to spaces through login policies so access follows team membership.
Workers and drift
26. Public or private worker pool: how do you decide?
The public pool runs on Spacelift's infrastructure and needs no maintenance. Private pools run in your environment under your cloud IAM role, can use private Docker registries and keep run state encrypted with keys only you hold. Choose private when security, compliance or network access requires it. Private pools need the Business plan or above.
27. What sets the maximum concurrency of a private pool?
The number of workers. Each worker processes one run at a time, so queued runs usually mean you need more workers or should spread scheduled work.
28. What network access do private workers need?
Outbound access to Spacelift, typically through a NAT gateway, because Spacelift SaaS does not offer PrivateLink or VPC peering. With HTTP long-poll, only outbound HTTPS on port 443 is needed. MQTT, the current default, is being sunset on 30 March 2027, and the docs recommend switching to HTTP long-poll by 1 January 2027.
29. How does drift detection work?
On a cron schedule you define, Spacelift runs proposed runs against the stack's current state to find changes made outside code. Drift detection only works on private workers. Drifted resources show in the Resources view and detection jobs send webhooks with a driftDetection field.
30. What is reconciliation and what are its limits?
If enabled, detected drift triggers a tracked run to bring infrastructure back to the code. That run follows the same rules as a manual tracked run, including auto-deploy and plan policies. If the stack's head commit changes during detection, reconciliation does not trigger automatically.
Scenario questions
31. A dependent stack did not run after its upstream stack succeeded. Why?
Check whether the upstream run was tracked rather than proposed, whether it was a retry (retries do not trigger dependents), whether the referenced output actually changed (without "Trigger always" an unchanged output does not trigger), and whether the upstream run had an apply phase.
32. Runs sit in Queued for a long time on a private pool. What do you check?
Stack locks, pending approvals and upstream dependencies first, then worker capacity. If all workers are busy, add workers or move drift schedules away from busy hours. Also check worker health and connectivity, especially if the pool still uses MQTT.
33. Your team still uses trigger policies to chain stacks. How do you migrate?
Map each trigger relationship to a stack dependency, replace passed values with output references, test the new graph on non-production stacks, then remove the trigger policies. Do not run both at once, because the docs warn that mixing them can cause confusion or loops.
34. Drift detection is enabled but nothing is reported. What could be wrong?
The stack may run on the public pool, where drift detection does not work. Otherwise check that a schedule exists, that the private workers are healthy, and that webhooks or notification policies route the results somewhere people read.
35. Someone deleted a production database through a Spacelift run. How do you prevent a repeat?
Add a plan policy that denies destruction of protected resource types in production, require an approval policy with named approvers for production stacks, and keep auto-deploy off. Test the plan policy with a sample input containing a delete so you know it works.
36. How would you give a new team self-service without risking other teams' stacks?
Create a child space for the team that inherits shared pools and baseline policies, map their identity group to that space with a login policy, and give them contexts for their own credentials. They can then create stacks within their space while policies from the parent still apply.
Preparing for the interview
Spacelift sits on top of Terraform or OpenTofu, so expect questions on state, modules and plans as well. Practise explaining a dependency graph on a whiteboard and writing a small Rego plan policy from memory. Our infrastructure as code tools guide puts Spacelift in context, and IaC testing before production covers the checks a platform team usually runs next to Spacelift policies. Our Terraform training covers the underlying tool in the Kharadi, Pune classroom and live online across India.
Spacelift changes quickly. Before an interview, read the current policy and worker pool pages, because deprecations such as trigger policies and the MQTT sunset are exactly what senior interviewers ask about.
FAQ
Which Spacelift policy types are deprecated?
Initialization and task policies are deprecated in favour of approval policies, trigger policies are mostly replaced by stack dependencies, and access policies are replaced by space access control.
Does Spacelift drift detection work on the public worker pool?
No. The docs state that drift detection only works on private workers.
Which Rego version should new Spacelift policies use?
Spacelift supports Rego v0 and v1 and recommends v1 for all new policies.
Do stack dependencies react to proposed runs?
No. Only tracked runs are respected. Proposed runs and tasks are ignored.
What is changing with private worker communication?
MQTT, the default transport, is being sunset on 30 March 2027. Spacelift recommends switching to HTTP long-poll by 1 January 2027; it needs only outbound HTTPS on port 443.
How are outputs passed between stacks?
Through output references, which expose an upstream output as an environment variable in the dependent stack. Use the TF_VAR_ prefix to pass it as a Terraform input variable.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0