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
I want a way to maybe get an environment variable from a context, and not fail if the environment variable does not exist for the context.

Please authenticate to join the conversation.

Upvoters
Status

πŸ‘€ In Review

Board

πŸ’‘ Feature Requests

Date

About 2 months ago

Subscribe to post

Get notified by email when there are changes.