Repository navigation
chore(docs): update documentation for coder_workspace_tags - #15620
Conversation
matifali
left a comment
There was a problem hiding this comment.
Left a few commnents but looks good to me.
|
|
||
| - You will need to have an [external provisioner](https://coder.com/docs/admin/provisioners#external-provisioners) with the correct tagset running in order to import this template. | ||
| - When specifying values for the `coder_workspace_tags` data source, you are restricted to using a subset of Terraform's capabilities. | ||
| - You must specify default values for all data sources and variables referenced by the `coder_workspace_tags` data source. |
There was a problem hiding this comment.
Are we exposing an explicit error if this is not the case to inform the user on what they can do to fix it. Think about it in context of #15447 .
There was a problem hiding this comment.
See below comment, but TL;DR yes.
| You may only specify the following as inputs for `coder_workspace_tags`: | ||
|
|
||
| | | Example | | ||
| | :----------------- | :-------------------------------------------- | | ||
| | Static values | `"developers"` | | ||
| | Template variables | `var.az` | | ||
| | Coder parameters | `data.coder_parameter.runtime_selector.value` | |
There was a problem hiding this comment.
But the value of the coder_parameter can itself come from any other local, resource, or data. Right?
There was a problem hiding this comment.
No, the default must be specified in the coder_parameter data source. I'll make this more explicit.
| All template variables and `coder_parameter` data sources **must** provide a | ||
| default value. Failure to do so will result in an error. |
There was a problem hiding this comment.
Can we be sure that the error is explicit and inform the user on how to fix it?
There was a problem hiding this comment.
There are some UI improvements to be made, but here are the main messages:
- Missing
tagsattribute ondata.coder_workspace_tags: https://github.com/coder/coder/blob/main/provisioner/terraform/tfparse/tfparse_test.go#L85 - Missing a default value for a tag: https://github.com/coder/coder/blob/main/provisioner/terraform/tfparse/tfparse_test.go#L187
- Disallowed data source for
coder_workspace_tagsvalue: https://github.com/coder/coder/blob/main/provisioner/terraform/tfparse/tfparse_test.go#L290 - Disallowed resource source for
coder_workspace_tagsvalue: https://github.com/coder/coder/blob/main/provisioner/terraform/tfparse/tfparse_test.go#L324 (This one needs to be improved) - Disallow function call in
coder_workspace_tagsvalue: https://github.com/coder/coder/blob/main/provisioner/terraform/tfparse/tfparse_test.go#L356
I'd rather not over-index on documenting package-level errors in documentation, but I can document these if you think it's necessary?
There was a problem hiding this comment.
It should end up in the API response returned by the backend, so all the FE needs to do is display it to the user 👍
There was a problem hiding this comment.
I think we should create an issue in coder/internal to track adding terraform errors to API response.
There was a problem hiding this comment.
I agree, but this might already be in the scope of #15447
Your call though!
Adds documentation relating to #15087 and #15427
See also: #15578