Skip to content

docs: describe workspace tags #13352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 23, 2024
Merged

docs: describe workspace tags #13352

merged 10 commits into from
May 23, 2024

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented May 23, 2024

Fixes: #13221

This PR adds the doc page for coder_workspace_tags describing the feature, its limitations, and a few samples.

Note:

If I can't merge it due to the links-checker reporting invalid URLs, I will open a separate PR for the example.

@mtojek mtojek self-assigned this May 23, 2024
@mtojek mtojek marked this pull request as ready for review May 23, 2024 12:16
@mtojek mtojek requested a review from johnstcn May 23, 2024 12:16
Comment on lines 22 to 50
data "coder_workspace_tags" "custom_workspace_tags" {
tags = {
"zone" = "developers"
"os" = data.coder_parameter.os_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"

option {
name = "Linux"
value = "linux"
}
option {
name = "OSX"
value = "osx"
}
option {
name = "Windows"
value = "windows"
}

mutable = false
}
Copy link
Member

@matifali matifali May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain if data.coder_parameter.os_selector represents the os of the workspace being provisioned? This example confuses me in understanding the purpose and benefits of using workspace_tags. If yes, then the code-server and the docker_container can only run on a Linux host. This feels incomplete on how a template can provide a workspace with three different OS using the new functionality and external-provisioners.

As this will also be published as an official example on https://registry.coder.com/templates, we should try to make the tags as practical as possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the example altogether, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the os_selector to runtime_selector, so it might be easier to comprehend that is about selecting either a free zone or an isolated, secure, air-gapped environment. I hope it makes it clear.

BTW I can modify it to depend on "foobars" too. My intention was to indicate the syntax rather providing use cases.

Copy link
Member

@matifali matifali May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better. But my opinion is that we should remove the example altogether if it is not usable out of the box. The docs are written well enough to serve the users who actually need to use this feature.

@@ -200,6 +200,11 @@
"description": "Prompt the template administrator for additional information about a template",
"path": "./templates/variables.md"
},
{
"title": "Workspace Tags",
"description": "Select provisioners using Coder Parameters",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SEO suggestion:

Suggested change
"description": "Select provisioners using Coder Parameters",
"description": "Control provisioning using Workspace Tags and Parameters",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good hint!

@matifali
Copy link
Member

matifali commented May 23, 2024

@johnstcn To dogfood this, I suggest we run provisioners on all dogfood regions and use workspace_tags to choose regions.

@mtojek
Copy link
Member Author

mtojek commented May 23, 2024

@matifali I'm happy to discuss improvements in docs, examples, and product expectations once you're back from PTO. It is hard to chat about plans here.

@johnstcn
Copy link
Member

@johnstcn To dogfood this, I suggest we run provisioners on all dogfood regions and use workspace_tags to choose regions.

Filed https://github.com/coder/dogfood/issues/77 to follow up.

@mtojek mtojek merged commit 98fa823 into main May 23, 2024
24 of 25 checks passed
@mtojek mtojek deleted the 13221-docs branch May 23, 2024 13:20
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: add docs and examples with coder_workspace_tags
3 participants