Skip to content

Commit 8099896

Browse files
change: use vault ttl for all non-lease secrets
Not all Vault secrets report back a `rotation_period`, but as long as they do not have a lease (for renewal) and report a `ttl`, we should be able to use the `ttl` value to determine the sleep duration. Fixes #1970
1 parent 781ce19 commit 8099896

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dependency/vault_common.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ func leaseCheckWait(s *Secret) time.Duration {
138138
}
139139
}
140140

141-
// Handle if this is a secret with a rotation period. If this is a rotating secret,
141+
// Handle if this is a secret with a ttl but without a lease. If this is a secret with a ttl,
142142
// the rotating secret's TTL will be the duration to sleep before rendering the new secret.
143143
var rotatingSecret bool
144-
if _, ok := s.Data["rotation_period"]; ok && s.LeaseID == "" {
144+
if s.LeaseID == "" {
145145
if ttlInterface, ok := s.Data["ttl"]; ok {
146146
if ttlData, err := ttlInterface.(json.Number).Int64(); err == nil {
147-
log.Printf("[DEBUG] Found rotation_period and set lease duration to %d seconds", ttlData)
147+
log.Printf("[DEBUG] Found ttl and set lease duration to %d seconds", ttlData)
148148
// Add a second for cushion
149149
base = int(ttlData) + 1
150150
rotatingSecret = true

0 commit comments

Comments
 (0)