Skip to content

coder_parameters of terraform module are not properly collected #8090

Closed
@sthdev

Description

@sthdev

Hi,

I have created a Terraform module, coder-template-base, which contains all the basic resources and data elements for all my Coder workspaces in Kubernetes, since these are mostly identical for all my workspace templates. In particular, coder-template-base contains several coder_parameters in order to allow users to adjust e.g. the home volume size.

The actual Coder workspace templates use and parameterize this module, roughly like this:

module "coder_template_base" {
  source = "git::https://gitlab.company.com/coder-templates/coder-template-base.git?ref=1.4.0"

  image_name = var.image_name
  image_tag  = var.image_tag

  home_vol_size_default  = 5

 coder_agent_startup_script_extension = <<EOT
 echo "Hello world"
 EOT
}

This works fine, the Coder UI properly shows input fields for all coder_parameters of coder-template-base, as long as the templates that use this module do not define coder_parameters of their own. If the template defines additional coder_parameters like in the example below, the Coder UI only shows these additional coder_parameters, but not those of coder-template-base.

module "coder_template_base" {
  source = "git::https://gitlab.example.com/coder-templates/coder-template-base.git?ref=1.4.0"

  image_name = var.image_name
  image_tag  = var.image_tag

  home_vol_size_default  = 5

 coder_agent_startup_script_extension = <<EOT
 curl -SL ${data.coder_parameter.tool_download_link.value} | tar -zx
 EOT
}

data "coder_parameter" "tool_download_link" {
  name         = "tool_download_link"
  display_name = "Tool Download Link"
  type         = "string"
  default      = "https://example.com/tool.tar.gz"
}

It looks like the algorithm, which collects all coder_parameters does not examine the imported modules if it already finds coder_parameters in the template's terraform files.

Metadata

Metadata

Assignees

Labels

s1Bugs that break core workflows. Only humans may set this.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions