Skip to content

feat: add expire_at to doppler_service_token#170

Open
jfrantz-cw wants to merge 1 commit into
DopplerHQ:masterfrom
jfrantz-cw:feat/service-token-expire-at
Open

feat: add expire_at to doppler_service_token#170
jfrantz-cw wants to merge 1 commit into
DopplerHQ:masterfrom
jfrantz-cw:feat/service-token-expire-at

Conversation

@jfrantz-cw
Copy link
Copy Markdown

TL;DR

Adds an optional expire_at argument to doppler_service_token so authors can declare token expiration in IaC. The Doppler API already accepts expire_at on token create; the provider just wasn't exposing it. Closes #62.

Why

doppler_service_token currently produces tokens that live forever until manually revoked. The Doppler API has supported an optional expire_at (RFC3339 timestamp) on POST /v3/configs/config/tokens for some time, but the provider never wired it through. This forces operators to either trust never-expiring service tokens or build out-of-band rotation tooling. Neither is great when the IaC repo is the canonical owner of those tokens.

Implementation

  • expire_at is an Optional, ForceNew string field validated as RFC3339. ForceNew because the Doppler API has no update path for token expiration; rotation requires a new token.
  • The new arg is conditionally added to the create payload only when non-empty, so existing token resources without expire_at continue to call the API exactly as before.
  • ServiceToken.ExpiresAt is captured from the response (json:"expires_at,omitempty") for completeness, though the Read function does not currently set it back on state. The asymmetric API naming (expire_at on request, expires_at on response) means refreshing it could mask user-input drift; deferring that decision since the field is ForceNew anyway.

Links

Adds an optional 'expire_at' argument (RFC3339 timestamp) on
doppler_service_token that maps to the Doppler API's existing
'expire_at' field on POST /v3/configs/config/tokens. When omitted,
behavior is unchanged (token never expires).

The field is ForceNew because the Doppler API does not support
updating a token's expiration after creation; rotation requires
a new token.

Closes DopplerHQ#62.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feature request: TTL for Service Tokens

1 participant