Skip to main content

Time Management Guide

Patterns and best practices for time-based resource management
2 min read

This guide covers common patterns and best practices for using the Time provider in your infrastructure.

Understanding Time Resources#

The Time provider offers four resource types:

ResourcePurposeUpdates
StaticCapture timestampNever (unless recreated)
OffsetCalculate future/past timeOn recreation or trigger
RotatingAutomatic rotationOn schedule
SleepAdd delaysOn every operation

Common Patterns#

Secret Rotation Pattern#

Automatically rotate secrets on a schedule:

Certificate Lifecycle Pattern#

Manage certificate creation and expiration:

Staged Deployment Pattern#

Deploy resources in stages with delays:

Expiration Management Pattern#

Track and manage resource expiration:

Best Practices#

Choose the Right Resource#

Use Static when:

  • Tracking resource creation time
  • Need unchanging timestamp
  • Building audit trails

Use Offset when:

  • Calculating future dates
  • Setting expiration times
  • Scheduling one-time events

Use Rotating when:

  • Implementing automatic rotation
  • Periodic updates needed
  • Triggering dependent resources

Use Sleep when:

  • Waiting for external systems
  • Rate limiting API calls
  • Allowing resources to stabilize

Rotation Schedule Guidelines#

Asset TypeRecommended RotationReason
Passwords90 daysSecurity compliance
API Keys30-90 daysLimit exposure window
Certificates90 days (renew at 60)Prevent expiration
Access Tokens24 hoursMinimize breach impact
Encryption Keys1 yearBalance security/overhead

Delay Guidelines#

Use minimum necessary delays:

Document why delays exist:

Time Zone Considerations#

All time resources use UTC:

Advanced Patterns#

Multi-Stage Rotation#

Different rotation schedules for different stages:

Coordinated Rotation#

Rotate multiple resources together:

Graceful Updates#

Handle rotation without downtime:

Troubleshooting#

Rotation Not Triggering#

Problem: Resources not recreating on rotation

Solution: Use replaceOnChanges

Unexpected Delays#

Problem: Deployments taking too long

Solution: Review and optimize sleep durations

Time Calculation Errors#

Problem: Incorrect time calculations

Solution: Use consistent time sources

Next Steps#