coder/examples/parameters-dynamic-options
Eric Paulsen ccda1c5c7d
fix: rm tf provider versions in examples/ (#9586)
2023-09-07 18:53:23 +00:00
..
README.md docs: describe dynamic options and locals (#9429) 2023-08-30 12:30:24 +02:00
main.tf fix: rm tf provider versions in examples/ (#9586) 2023-09-07 18:53:23 +00:00
variables.yml docs: describe dynamic options and locals (#9429) 2023-08-30 12:30:24 +02:00

README.md

name description tags icon
Sample Template with Dynamic Parameter Options Review the sample template and introduce dynamic parameter options to your template
local
docker
parameters
/icon/docker.png

Overview

This Coder template presents use of dynamic parameter options and Terraform locals.

Use case

The Coder template makes use of Docker containers to provide workspace users with programming language SDKs like Go, Java, and more. The template administrator wants to make sure that only certain versions of these programming environments are available, without allowing users to manually change them.

Workspace users should simply choose the programming environment they prefer. When the template admin upgrades SDK versions, during the next workspace update the chosen environment will automatically be upgraded to the latest version without causing any disruption or prompts.

The references to Docker images are represented by Terraform variables, and they're passed via the configuration file like this:

go_image: "bitnami/golang:1.20-debian-11"
java_image: "bitnami/java:1.8-debian-11

The template admin needs to update image references, publish a new version of the template, and then either handle workspace updates on their own or let workspace users take care of it.

Development

Update the template and push it using the following command:

./scripts/coder-dev.sh templates push examples-parameters-dynamic-options \
  -d examples/parameters-dynamic-options \
  --variables-file examples/parameters-dynamic-options/variables.yml \
  --create \
  -y