--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "coder_parameter Data Source - terraform-provider-coder" subcategory: "" description: |- Use this data source to configure editable options for workspaces. --- # coder_parameter (Data Source) Use this data source to configure editable options for workspaces. ## Example Usage ```terraform provider "coder" {} data "coder_parameter" "example" { name = "Region" description = "Specify a region to place your workspace." mutable = false type = "string" default = "us-central1-a" option { value = "us-central1-a" name = "US Central" icon = "/icons/1f1fa-1f1f8.png" } option { value = "asia-southeast1-a" name = "Singapore" icon = "/icons/1f1f8-1f1ec.png" } } data "coder_parameter" "ami" { name = "Machine Image" description = <<-EOT # Provide the machine image See the [registry](https://container.registry.blah/namespace) for options. EOT option { value = "ami-xxxxxxxx" name = "Ubuntu" icon = "/icon/ubuntu.svg" } } data "coder_parameter" "is_public_instance" { name = "Is public instance?" type = "bool" icon = "/icon/docker.svg" default = false } data "coder_parameter" "cores" { name = "CPU Cores" type = "number" icon = "/icon/cpu.svg" default = 3 order = 10 } data "coder_parameter" "disk_size" { name = "Disk Size" type = "number" default = "5" order = 8 validation { # This can apply to number. min = 0 max = 10 monotonic = "increasing" } } data "coder_parameter" "cat_lives" { name = "Cat Lives" type = "number" default = "9" validation { # This can apply to number. min = 0 max = 10 monotonic = "decreasing" } } data "coder_parameter" "fairy_tale" { name = "Fairy Tale" type = "string" mutable = true default = "Hansel and Gretel" ephemeral = true } data "coder_parameter" "users" { name = "system_users" display_name = "System users" type = "list(string)" default = jsonencode(["root", "user1", "user2"]) } data "coder_parameter" "home_volume_size" { name = "Home Volume Size" description = <<-EOF How large should your home volume be? EOF type = "number" default = 30 mutable = true order = 3 option { name = "30GB" value = 30 } option { name = "60GB" value = 60 } option { name = "100GB" value = 100 } validation { monotonic = "increasing" } } ``` <!-- schema generated by tfplugindocs --> ## Schema ### Required - `name` (String) The name of the parameter. If this is changed, developers will be re-prompted for a new value. ### Optional - `default` (String) A default value for the parameter. - `description` (String) Describe what this parameter does. - `display_name` (String) The displayed name of the parameter as it will appear in the interface. - `ephemeral` (Boolean) The value of an ephemeral parameter will not be preserved between consecutive workspace builds. - `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons [here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`. - `mutable` (Boolean) Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution! - `option` (Block List) Each `option` block defines a value for a user to select from. (see [below for nested schema](#nestedblock--option)) - `order` (Number) The order determines the position of a template parameter in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by name (ascending order). - `type` (String) The type of this parameter. Must be one of: `"number"`, `"string"`, `"bool"`, or `"list(string)"`. - `validation` (Block List, Max: 1) Validate the input of a parameter. (see [below for nested schema](#nestedblock--validation)) ### Read-Only - `id` (String) The ID of this resource. - `optional` (Boolean) Whether this value is optional. - `value` (String) The output value of the parameter. <a id="nestedblock--option"></a> ### Nested Schema for `option` Required: - `name` (String) The display name of this value in the UI. - `value` (String) The value of this option set on the parameter if selected. Optional: - `description` (String) Describe what selecting this value does. - `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons [here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`. <a id="nestedblock--validation"></a> ### Nested Schema for `validation` Optional: - `error` (String) An error message to display if the value breaks the validation rules. The following placeholders are supported: {max}, {min}, and {value}. - `max` (Number) The maximum of a number parameter. - `min` (Number) The minimum of a number parameter. - `monotonic` (String) Number monotonicity, either increasing or decreasing. - `regex` (String) A regex for the input parameter to match against. Read-Only: - `max_disabled` (Boolean) Helper field to check if max is present - `min_disabled` (Boolean) Helper field to check if min is present