How to retrieve sensitive output values from OpenTofu/Terraform stacks

Last updated: November 26, 2026

Outputs marked sensitive = true are masked in the Spacelift UI and logs. You can pass them to other stacks through stack dependencies, or read one yourself in a task.

Pass sensitive outputs to other stacks

  1. On the stack that produces the output, set Transfer sensitive outputs across dependencies to Enabled.

  2. On private workers, add SPACELIFT_SENSITIVE_OUTPUT_UPLOAD_ENABLED=true to the worker, not to the stack. Public workers have it enabled already.

    • Docker-based and EC2 workers: set it in the launcher's environment. With the EC2 Terraform module, add it to env_vars.

    • Kubernetes workers: set it in spec.pod.workerContainer.env on the WorkerPool.

  3. Use Trigger with force apply on the producing stack. Outputs are only uploaded during an apply phase, so this makes them available to dependent stacks.

The uploaded values stay masked in the UI and logs. If a dependent run fails with job assignment failed: the following inputs are missing, the producing stack hasn't uploaded the output in an apply yet. Repeat step 3.

If the stacks are in different spaces, check the permissions needed for cross-space dependencies in the stack dependencies docs.

Read a sensitive value

Run this as a task on the stack:

tofu output -raw <output_name>

Use -json instead of -raw for maps and lists, and terraform instead of tofu on Terraform stacks. For a resource attribute that isn't an output, run tofu state pull and find the value in the JSON it prints.

Important security considerations

Security Warning: The value appears in plain text in the task's logs. Anyone with read access to the stack's space can see it, so only do this when you need to.

Sources