Skip to content

Evaluate coder_workspace_tags during template create/push #15427

Closed

Description

@bpmct

The coder_workspace_tags data source is not respected or read from the template during template imports, but it works for template builds. As a workaround, the admin must run a generic provisioner simply for template imports AND/OR set tags manually in the template UI.

This is a bad workaround as certain provisioners must be run just for template imports. From #15047:

It's definitely a bug that we don't process coder_workspace_tags for template import jobs. A full fix would have us directly inspect the HCL on coderd to find the coder_workspace_tags and the coder_parameters, then resolve the tags based on the parameters passed to the import job.

Related PRs:

Activity

  1. added
    need-backend
    on Nov 7, 2024
  2. changed the title [-]Evaluate `coder_workspace_tags` during template imports[/-] [+]Evaluate `coder_workspace_tags` during template create/push[/+] on Nov 7, 2024
  3. added
    must-do
    on Nov 7, 2024
  4. johnstcn commented on Nov 8, 2024

    @johnstcn
    Member

    One potential issue with this approach is that the use of functions will be severely limited.
    Terraform does not export its default set of functions, to be used while evaluating Terraform. Even if we were to copy that directly, there are a number of functions also defined in internal/lang.
    In order to allow using the full set of functions while taking the current 'static analysis' approach, we'd essentially have to manually vendor all of the function definitions.

  5. bpmct commented on Nov 8, 2024

    @bpmct
    MemberAuthor

    One potential issue with this approach is that the use of functions will be severely limited. Terraform does not export its default set of functions, to be used while evaluating Terraform. Even if we were to copy that directly, there are a number of functions also defined in internal/lang. In order to allow using the full set of functions while taking the current 'static analysis' approach, we'd essentially have to manually vendor all of the function definitions.

    This applies to workspace builds too, right? Not just template builds. We may want to extract function handling or these other edge cases into another issue such as #15087.

    But yeah, it seems like it probably would not be best to support any Terraform functions as we'd essentially have to rewrite their stuff.

  6. johnstcn commented on Nov 25, 2024

    @johnstcn
    Member

    #15578 adds logic to extract and validate tags from uploaded templates.
    Docs are updated in #15620.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

must-doneed-backend

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions