Skip to main content

Expiring Environment Variables/Context Variables

I often would like to store a short-lived API key or something into Spacelift and I often find myself updating the description to say “This expires at this date” for this context env var.

It would be nice if spacelift could understand the concept of short-lived things, have the ability to set an expiry date on an env var and then when spacelift tries to trigger a run it could fail saying “Variable expired, please update”

Problem
Status: ❌ Rejected1 comment

Log in to comment and vote

Comments1

  • Black Breeze

    •

    Dec 9, 2025

    I will be honest with you @James Humphries - I don’t love this idea.

    Presumably what you’re storing here are external credentials, right? So when they expire, they expire externally, right? They expire presumably because you either explicitly chose the expiry date, or it’s predefined by the external service. Spacelift is not a source of truth here, so you’re effectively asking us to store an information for which we’re not the canonical source, and cannot really know if it’s right or wrong. It introduces ambiguity. When done right, it can be helpful, but it can also be confusing.

    The other thing I don’t like about it is the explicit failure that this causes. If the credential is expired, your runs will fail anyway, hopefully with an informative error message. You’re not preventing run failures with this feature, you just make your runs maybe fail more nicely. But if you want to prevent these failures you still need to set dates in the calendar, unless we add another feature that keeps alerting you about impending expiration which may or may not be correct (see the previous paragraph).

    In a nutshell, it doesn’t feel like the right layer to solve this problem. To me it feels like to do this properly you’d really want a secrets manager like OpenBao or Infisical. Not owning the secret’s lifecycle Spacelift would be a poor man’s version of any of these. And that’s not where we position ourselves. We want to be best-in-class, which means picking your battles as you can’t possibly be best in everything.

    If you’re OK with a poor man’s solution, Spacelift offers variable descriptions. Just put your expiry date there and call it a day :)