Skip to content
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

feat: store coder_workspace_tags in the database #13294

Merged
merged 27 commits into from
May 20, 2024
Merged

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented May 16, 2024

Fixes: #13218
Follow-up: #13219

Note: I know this PR is relatively large, but there are chunks of generated code.

Changes:

  • add database table template_version_workspace_tags to store tags extracted from the template in the database (will be used in the follow up PR)
  • add logic to insert/query workspace tags from the database
  • update dependency on terraform-provider-coder
  • terraform runner can parse and extract workspace tags from a template

Terraform preview:

[API] 2024-05-17 10:56:18.081 [info]  terraform: unpacking template source archive  session_id=5c2d05eb-8b1b-476b-9f4b-7c8bf804a2fa  size_bytes=44544
[API] 2024-05-17 10:56:18.087 [info]  terraform: workspace tag found  key=cluster  value="\"developers\""
[API] 2024-05-17 10:56:18.087 [info]  terraform: workspace tag found  key=os  value=data.coder_parameter.os_selector.value
[API] 2024-05-17 10:56:18.087 [info]  terraform: workspace tag found  key=debug  value="\"${data.coder_parameter.feature_debug_enabled.value}+12345\""
[API] 2024-05-17 10:56:18.087 [info]  terraform: workspace tag found  key=cache  value="data.coder_parameter.feature_cache_enabled.value == \"true\" ? \"nix-with-cache\" : \"no-cache\""

Database preview:

select * from template_version_workspace_tags;
         template_version_id          |   key   |                                           value
--------------------------------------+---------+--------------------------------------------------------------------------------------------
 c7da54e8-37a3-4374-b103-bb76f9bd189b | cluster | "developers"
 c7da54e8-37a3-4374-b103-bb76f9bd189b | os      | data.coder_parameter.os_selector.value
 c7da54e8-37a3-4374-b103-bb76f9bd189b | debug   | "${data.coder_parameter.feature_debug_enabled.value}+12345"
 c7da54e8-37a3-4374-b103-bb76f9bd189b | cache   | data.coder_parameter.feature_cache_enabled.value == "true" ? "nix-with-cache" : "no-cache"
(4 rows)

@mtojek mtojek self-assigned this May 16, 2024
@mtojek mtojek requested review from johnstcn and mafredri May 17, 2024 12:24
@mtojek mtojek marked this pull request as ready for review May 17, 2024 12:24
@mtojek mtojek enabled auto-merge (squash) May 20, 2024 13:30
@mtojek mtojek merged commit b8b80fe into main May 20, 2024
37 checks passed
@mtojek mtojek deleted the 13218-workspace-tags branch May 20, 2024 13:30
@github-actions github-actions bot locked and limited conversation to collaborators May 20, 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.

coderd: implement coder_workspace_tags
2 participants