Skip to main content

Non-failing spacelift_environment_variable data source

Using the [spacelift provider](

https://search.opentofu.org/provider/spacelift-io/spacelift/latest

), I want to get a certain environment variable from a list of contexts. However, some of the contexts may be missing the environment variable. If I use the [spacelift_environment_variable data source](

https://search.opentofu.org/provider/spacelift-io/spacelift/latest/docs/datasources/environment_variable), it raises an error if the environment variable for a certain context doesn’t exist. There is no way to have to return a default value or otherwise not fail an OpenTofu plan and apply.

This relates to my other request:

https://feedback.spacelift.io/p/ability-to-get-all-environment-variables-for-a-context

Workaround
No.
Problem

Log in to comment and vote

No comments yet

Be the first to share your thoughts.