You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce support for a TTL (Time-To-Live) configuration for prebuilt workspaces, enabling automatic invalidation and replacement of unclaimed prebuilds after a specified duration.
When defining a prebuild in Terraform, users should be able to set the maximum lifetime of a prebuild using the invalidate_after_secs field under the cache_invalidation block. After this duration has passed, the prebuild should be considered stale and be replaced automatically.
## Summary
This PR introduces support for expiration policies in prebuilds. The TTL
(time-to-live) is retrieved from the Terraform configuration
([terraform-provider-coder
PR](coder/terraform-provider-coder#404)):
```
prebuilds = {
instances = 2
expiration_policy {
ttl = 86400
}
}
```
**Note**: Since there is no need for precise TTL enforcement down to the
second, in this implementation expired prebuilds are handled in a single
reconciliation cycle: they are deleted, and new instances are created
only if needed to match the desired count.
## Changes
* The outcome of a reconciliation cycle is now expressed as a slice of
reconciliation actions, instead of a single aggregated action.
* Adjusted reconciliation logic to delete expired prebuilds and
guarantee that the number of desired instances is correct.
* Updated relevant data structures and methods to support expiration
policies parameters.
* Added documentation to `Prebuilt workspaces` page
* Update `terraform-provider-coder` to version 2.5.0:
https://github.com/coder/terraform-provider-coder/releases/tag/v2.5.0
Depends on: coder/terraform-provider-coder#404Fixes: #17916
Description
Introduce support for a TTL (Time-To-Live) configuration for prebuilt workspaces, enabling automatic invalidation and replacement of unclaimed prebuilds after a specified duration.
When defining a prebuild in Terraform, users should be able to set the maximum lifetime of a prebuild using the
invalidate_after_secs
field under thecache_invalidation
block. After this duration has passed, the prebuild should be considered stale and be replaced automatically.This feature will help prevent stale workspaces due to outdated codebases or infrastructure changes (e.g., new VM images).
The text was updated successfully, but these errors were encountered: