Skip to content

chore: add minimum TTL value for expiration.policy.ttl #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

ssncferreira
Copy link
Contributor

@ssncferreira ssncferreira commented May 26, 2025

Summary

This PR improves validation for the expiration_policy.ttl field in the Terraform schema by allowing an explicit value of 0 to disable expiration, while also enforcing a valid range of 3600 seconds (1 hour) to 31536000 seconds (1 year) for all other values. This ensures that prebuild TTLs are not configured with values that are too short, which could lead to premature expiration and unnecessary prebuild churn.

Changes

  • Replaced validation.IntBetween with a custom validation function.
  • TTL is now allowed to be:
    • 0 disables expiration
    • Between 3600 and 31536000 to enforce TTL values between 1 hour and 1 year.

No functional changes beyond input validation.

Related to: #404

@ssncferreira ssncferreira marked this pull request as ready for review May 26, 2025 18:43
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the disable gotcha, LGTM 👍🏻

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ssncferreira ssncferreira requested a review from mafredri May 27, 2025 09:25
@ssncferreira ssncferreira merged commit 442ff2a into main May 27, 2025
6 checks passed
@ssncferreira ssncferreira deleted the ssncferreira/chore-prebuild-ttl-min-validation branch May 27, 2025 10:04
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants