Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename os to runtime
  • Loading branch information
mtojek committed May 23, 2024
commit cfd0c2364da9dea471fdc0c6658ffdf68fb5f269
13 changes: 7 additions & 6 deletions docs/templates/workspace-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ specified:
data "coder_workspace_tags" "custom_workspace_tags" {
tags = {
"zone" = "developers"
"os" = data.coder_parameter.os_selector.value
"runtime" = data.coder_parameter.runtime_selector.value
"project_id" = "PROJECT_${data.coder_parameter.project_name.value}"
"cache" = data.coder_parameter.feature_cache_enabled.value == "true" ? "with-cache" : "no-cache"
}
Expand All @@ -28,8 +28,8 @@ data "coder_workspace_tags" "custom_workspace_tags" {
**Legend**

- `zone` - static tag value set to `developers`
- `os` - supported by the string-type `coder_parameter` to select OS
runtime,`os_selector`
- `runtime` - supported by the string-type `coder_parameter` to select
provisioner runtime, `runtime_selector`
- `project_id` - a formatted string supported by the string-type
`coder_parameter`, `project_name`
- `cache` - an HCL condition involving boolean-type `coder_parameter`,
Expand All @@ -54,9 +54,10 @@ that every tag set is associated with at least one healthy provisioner.

Provisioners require job tags to be defined in plain string format. When a
workspace tag refers to a `coder_parameter` without involving the string
formatter, for example, (`"os" = data.coder_parameter.os_selector.value`), the
Coder provisioner server can transform only the following parameter types to
strings: _string_, _number_, and _bool_.
formatter, for example,
(`"runtime" = data.coder_parameter.runtime_selector.value`), the Coder
provisioner server can transform only the following parameter types to strings:
_string_, _number_, and _bool_.

### Mutability

Expand Down
22 changes: 11 additions & 11 deletions examples/workspace-tags/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ data "coder_workspace" "me" {
data "coder_workspace_tags" "custom_workspace_tags" {
tags = {
"zone" = "developers"
"os" = data.coder_parameter.os_selector.value
"runtime" = data.coder_parameter.runtime_selector.value
"project_id" = "PROJECT_${data.coder_parameter.project_name.value}"
"cache" = data.coder_parameter.feature_cache_enabled.value == "true" ? "with-cache" : "no-cache"
}
}

data "coder_parameter" "os_selector" {
name = "os_selector"
display_name = "OS runtime"
default = "linux"
data "coder_parameter" "runtime_selector" {
name = "runtime_selector"
display_name = "Provisioner Runtime"
default = "development"

option {
name = "Linux"
value = "linux"
name = "Development (free zone)"
value = "development"
}
option {
name = "OSX"
value = "osx"
name = "Staging (internal access)"
value = "staging"
}
option {
name = "Windows"
value = "windows"
name = "Production (air-gapped)"
value = "production"
}

mutable = false
Expand Down