The time.Rotating resource creates a timestamp that automatically changes based on a rotation schedule, useful for triggering resource recreation.
Example Usage#
Basic Rotation#
With Secret Rotation#
Monthly Rotation#
Custom Rotation Period#
Argument Reference#
Optional Arguments#
rotationDays(number): Number of days between rotations.rotationHours(number): Number of hours between rotations.rotationMinutes(number): Number of minutes between rotations.rotationMonths(number): Number of months between rotations.rotationRfc3339(string): Base timestamp for rotation calculation in RFC3339 format.rotationYears(number): Number of years between rotations.triggers(map): Arbitrary map of values that forces new rotation.
Attribute Reference#
day(number): Day of the current rotation (1-31).hour(number): Hour of the current rotation (0-23).id(string): Unique identifier that changes on each rotation.minute(number): Minute of the current rotation (0-59).month(number): Month of the current rotation (1-12).rfc3339(string): Current rotation timestamp in RFC3339 format.second(number): Second of the current rotation (0-59).unix(number): Current rotation Unix timestamp.year(number): Year of the current rotation.
Use Cases#
API Key Rotation#
Certificate Rotation#
Database Password Rotation#
Token Rotation#
Rotation Behavior#
- The rotation occurs when
pulumi upis run after the rotation period has elapsed - Multiple rotation periods (days, hours, minutes) are cumulative
- The resource ID changes on each rotation, triggering dependent resources
- First rotation happens when the resource is created
Example: Multi-Environment Rotation#
Import#
Time rotating resources cannot be imported as they represent time-based triggers rather than existing infrastructure.
Notes#
- Rotations only occur during
pulumi upafter the period has elapsed - The
idattribute changes on each rotation - Use
replaceOnChangesto trigger dependent resource recreation - Rotation periods are cumulative (e.g., rotationDays + rotationHours)
- Consider time zone implications (all times are UTC)