Description
Prebuilt workspaces will become stale if not claimed. Examples:
- A monorepo cloned during prebuild will fall behind its origin
- A new VM AMI or container image may release after a workspace was created
When defining a prebuild, the following syntax should configure a maximum lifetime for a prebuild, after which such an unclaimed prebuild must be deleted and replaced.
resource "coder_workspace_preset" "us-nix" {
name = "Nix US"
parameters = {
(data.coder_parameter.region.name) = "us-pittsburgh"
(data.coder_parameter.image_type.name) = "codercom/oss-dogfood-nix:latest"
}
# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
prebuilds = {
instances = 2
cache_invalidation = {
# See the Invalidation section for more
invalidate_after_secs = 86400
}
autoscaling = {
... # See the Autoscaling section for examples
}
}
}
Furthermore, it should be possible to invalidate a prebuild using the API. This might already be possible by using the endpoint that deletes a workspace.