Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.73 KB

workspace_preset.md

File metadata and controls

53 lines (38 loc) · 2.73 KB
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 not defined by the preset will still be configurable when creating a workspace.

coder_workspace_preset (Data Source)

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 not defined by the preset will still be configurable when creating a workspace.

Example Usage

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"
  }
}

Schema

Required

  • name (String) The name of the workspace preset.

Optional

  • 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) Prebuilt workspace configuration related to this workspace preset. Coder will build and maintain workspaces in reserve based on this configuration. When a user creates a new workspace using a preset, they will be assigned a prebuilt workspace, instead of waiting for a new workspace to build. (see below for nested schema)

Read-Only

  • id (String) The preset ID is automatically generated and may change between runs. It is recommended to use the name attribute to identify the preset.

Nested Schema for prebuilds

Required:

  • instances (Number) The number of workspaces to keep in reserve for this preset.