mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
6f6e73af03
## 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](https://github.com/coder/terraform-provider-coder/pull/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: https://github.com/coder/terraform-provider-coder/pull/404 Fixes: https://github.com/coder/coder/issues/17916
266 lines
8.8 KiB
JSON
Generated
266 lines
8.8 KiB
JSON
Generated
{
|
|
"format_version": "1.0",
|
|
"terraform_version": "1.11.4",
|
|
"values": {
|
|
"root_module": {
|
|
"resources": [
|
|
{
|
|
"address": "data.coder_parameter.sample",
|
|
"mode": "data",
|
|
"type": "coder_parameter",
|
|
"name": "sample",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"default": "ok",
|
|
"description": "blah blah",
|
|
"display_name": null,
|
|
"ephemeral": false,
|
|
"form_type": "input",
|
|
"icon": null,
|
|
"id": "491d202d-5658-40d9-9adc-fd3a67f6042b",
|
|
"mutable": false,
|
|
"name": "Sample",
|
|
"option": null,
|
|
"optional": true,
|
|
"order": null,
|
|
"styling": "{}",
|
|
"type": "string",
|
|
"validation": [],
|
|
"value": "ok"
|
|
},
|
|
"sensitive_values": {
|
|
"validation": []
|
|
}
|
|
},
|
|
{
|
|
"address": "data.coder_workspace_preset.MyFirstProject",
|
|
"mode": "data",
|
|
"type": "coder_workspace_preset",
|
|
"name": "MyFirstProject",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"id": "My First Project",
|
|
"name": "My First Project",
|
|
"parameters": {
|
|
"Sample": "A1B2C3"
|
|
},
|
|
"prebuilds": [
|
|
{
|
|
"expiration_policy": [
|
|
{
|
|
"ttl": 86400
|
|
}
|
|
],
|
|
"instances": 4
|
|
}
|
|
]
|
|
},
|
|
"sensitive_values": {
|
|
"parameters": {},
|
|
"prebuilds": [
|
|
{
|
|
"expiration_policy": [
|
|
{}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"address": "coder_agent.dev",
|
|
"mode": "managed",
|
|
"type": "coder_agent",
|
|
"name": "dev",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 1,
|
|
"values": {
|
|
"api_key_scope": "all",
|
|
"arch": "arm64",
|
|
"auth": "token",
|
|
"connection_timeout": 120,
|
|
"dir": null,
|
|
"display_apps": [
|
|
{
|
|
"port_forwarding_helper": true,
|
|
"ssh_helper": true,
|
|
"vscode": true,
|
|
"vscode_insiders": false,
|
|
"web_terminal": true
|
|
}
|
|
],
|
|
"env": null,
|
|
"id": "8cfc2f0d-5cd6-4631-acfa-c3690ae5557c",
|
|
"init_script": "",
|
|
"metadata": [],
|
|
"motd_file": null,
|
|
"order": null,
|
|
"os": "windows",
|
|
"resources_monitoring": [],
|
|
"shutdown_script": null,
|
|
"startup_script": null,
|
|
"startup_script_behavior": "non-blocking",
|
|
"token": "abc9d31e-d1d6-4f2c-9e35-005ebe39aeec",
|
|
"troubleshooting_url": null
|
|
},
|
|
"sensitive_values": {
|
|
"display_apps": [
|
|
{}
|
|
],
|
|
"metadata": [],
|
|
"resources_monitoring": [],
|
|
"token": true
|
|
}
|
|
},
|
|
{
|
|
"address": "null_resource.dev",
|
|
"mode": "managed",
|
|
"type": "null_resource",
|
|
"name": "dev",
|
|
"provider_name": "registry.terraform.io/hashicorp/null",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"id": "2891968445819247679",
|
|
"triggers": null
|
|
},
|
|
"sensitive_values": {},
|
|
"depends_on": [
|
|
"coder_agent.dev"
|
|
]
|
|
}
|
|
],
|
|
"child_modules": [
|
|
{
|
|
"resources": [
|
|
{
|
|
"address": "module.this_is_external_module.data.coder_parameter.first_parameter_from_module",
|
|
"mode": "data",
|
|
"type": "coder_parameter",
|
|
"name": "first_parameter_from_module",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"default": "abcdef",
|
|
"description": "First parameter from module",
|
|
"display_name": null,
|
|
"ephemeral": false,
|
|
"form_type": "input",
|
|
"icon": null,
|
|
"id": "0a4d1299-b174-43b0-91ad-50c1ca9a4c25",
|
|
"mutable": true,
|
|
"name": "First parameter from module",
|
|
"option": null,
|
|
"optional": true,
|
|
"order": null,
|
|
"styling": "{}",
|
|
"type": "string",
|
|
"validation": [],
|
|
"value": "abcdef"
|
|
},
|
|
"sensitive_values": {
|
|
"validation": []
|
|
}
|
|
},
|
|
{
|
|
"address": "module.this_is_external_module.data.coder_parameter.second_parameter_from_module",
|
|
"mode": "data",
|
|
"type": "coder_parameter",
|
|
"name": "second_parameter_from_module",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"default": "ghijkl",
|
|
"description": "Second parameter from module",
|
|
"display_name": null,
|
|
"ephemeral": false,
|
|
"form_type": "input",
|
|
"icon": null,
|
|
"id": "f0812474-29fd-4c3c-ab40-9e66e36d4017",
|
|
"mutable": true,
|
|
"name": "Second parameter from module",
|
|
"option": null,
|
|
"optional": true,
|
|
"order": null,
|
|
"styling": "{}",
|
|
"type": "string",
|
|
"validation": [],
|
|
"value": "ghijkl"
|
|
},
|
|
"sensitive_values": {
|
|
"validation": []
|
|
}
|
|
}
|
|
],
|
|
"address": "module.this_is_external_module",
|
|
"child_modules": [
|
|
{
|
|
"resources": [
|
|
{
|
|
"address": "module.this_is_external_module.module.this_is_external_child_module.data.coder_parameter.child_first_parameter_from_module",
|
|
"mode": "data",
|
|
"type": "coder_parameter",
|
|
"name": "child_first_parameter_from_module",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"default": "abcdef",
|
|
"description": "First parameter from child module",
|
|
"display_name": null,
|
|
"ephemeral": false,
|
|
"form_type": "input",
|
|
"icon": null,
|
|
"id": "27b5fae3-7671-4e61-bdfe-c940627a21b8",
|
|
"mutable": true,
|
|
"name": "First parameter from child module",
|
|
"option": null,
|
|
"optional": true,
|
|
"order": null,
|
|
"styling": "{}",
|
|
"type": "string",
|
|
"validation": [],
|
|
"value": "abcdef"
|
|
},
|
|
"sensitive_values": {
|
|
"validation": []
|
|
}
|
|
},
|
|
{
|
|
"address": "module.this_is_external_module.module.this_is_external_child_module.data.coder_parameter.child_second_parameter_from_module",
|
|
"mode": "data",
|
|
"type": "coder_parameter",
|
|
"name": "child_second_parameter_from_module",
|
|
"provider_name": "registry.terraform.io/coder/coder",
|
|
"schema_version": 0,
|
|
"values": {
|
|
"default": "ghijkl",
|
|
"description": "Second parameter from child module",
|
|
"display_name": null,
|
|
"ephemeral": false,
|
|
"form_type": "input",
|
|
"icon": null,
|
|
"id": "d285bb17-27ff-4a49-a12b-28582264b4d9",
|
|
"mutable": true,
|
|
"name": "Second parameter from child module",
|
|
"option": null,
|
|
"optional": true,
|
|
"order": null,
|
|
"styling": "{}",
|
|
"type": "string",
|
|
"validation": [],
|
|
"value": "ghijkl"
|
|
},
|
|
"sensitive_values": {
|
|
"validation": []
|
|
}
|
|
}
|
|
],
|
|
"address": "module.this_is_external_module.module.this_is_external_child_module"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|