page_title | subcategory | description |
---|---|---|
coder_workspace_preset Data Source - terraform-provider-coder |
Use this data source to predefine common configurations for coder workspaces. Users will have the option to select a defined preset, which will automatically apply the selected configuration. Any parameters defined in the preset will be applied to the workspace. Parameters that are defined by the template but not defined by the preset will still be configurable when creating a workspace. |
Use this data source to predefine common configurations for coder workspaces. Users will have the option to select a defined preset, which will automatically apply the selected configuration. Any parameters defined in the preset will be applied to the workspace. Parameters that are defined by the template but not defined by the preset will still be configurable when creating a workspace.
provider "coder" {}
# presets can be used to predefine common configurations for workspaces
# Parameters are referenced by their name. Each parameter must be defined in the preset.
# Values defined by the preset must pass validation for the parameter.
# See the coder_parameter data source's documentation for examples of how to define
# parameters like the ones used below.
data "coder_workspace_preset" "example" {
name = "example"
parameters = {
(data.coder_parameter.example.name) = "us-central1-a"
(data.coder_parameter.ami.name) = "ami-xxxxxxxx"
}
}
name
(String) The name of the workspace preset.
parameters
(Map of String) Workspace parameters that will be set by the workspace preset. For simple templates that only need prebuilds, you may define a preset with zero parameters. Because workspace parameters may change between Coder template versions, preset parameters are allowed to define values for parameters that do not exist in the current template version.prebuilds
(Block Set, Max: 1) Configuration for prebuilt workspaces associated with this preset. Coder will maintain a pool of standby workspaces based on this configuration. When a user creates a workspace using this preset, they are assigned a prebuilt workspace instead of waiting for a new one to build. See prebuilt workspace documentation here (see below for nested schema)
id
(String) The preset ID is automatically generated and may change between runs. It is recommended to use thename
attribute to identify the preset.
Required:
instances
(Number) The number of workspaces to keep in reserve for this preset.
Optional:
expiration_policy
(Block Set, Max: 1) Configuration block that defines TTL (time-to-live) behavior for prebuilds. Use this to automatically invalidate and delete prebuilds after a certain period, ensuring they stay up-to-date. (see below for nested schema)scheduling
(Block List, Max: 1) Configuration block that defines scheduling behavior for prebuilds. Use this to automatically adjust the number of prebuild instances based on a schedule. (see below for nested schema)
Required:
ttl
(Number) Time in seconds after which an unclaimed prebuild is considered expired and eligible for cleanup.
Required:
schedule
(Block List, Min: 1) One or more schedule blocks that define when to scale the number of prebuild instances. (see below for nested schema)timezone
(String) The timezone to use for the prebuild schedules (e.g., "UTC", "America/New_York"). Timezone must be a valid timezone in the IANA timezone database. See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a complete list of valid timezone identifiers and https://www.iana.org/time-zones for the official IANA timezone database.
Required:
cron
(String) A cron expression that defines when this schedule should be active. The cron expression must be in the format "* HOUR * * DAY-OF-WEEK" where HOUR is 0-23 and DAY-OF-WEEK is 0-6 (Sunday-Saturday). The minute, day-of-month, and month fields must be "*".instances
(Number) The number of prebuild instances to maintain during this schedule period.