From 63e28c0e95e33ed53f3d391e55fbc8b2e968672c Mon Sep 17 00:00:00 2001 From: justmanuel <56279646+justmanuel@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:01:05 -0500 Subject: [PATCH] Enable Devcontainer-cli module to block user login until script finishes running (#759) ## Description Allow for devcontainer-cli module to prevent users from logging in until its finished running. ## Type of Change - [ ] New module - [ ] New template - [ ] Bug fix - [x ] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information **Path:** `registry/coder/modules/devcontainers-cli` **New version:** `1.1.0` **Breaking change:** [ ] Yes [x ] No ## Testing & Validation - [x] Tests pass (`bun test`) - [ ] Code formatted (`bun fmt`) - [ x] Changes tested locally ## Related Issues None --------- Co-authored-by: DevCats Co-authored-by: DevCats --- .../coder/modules/devcontainers-cli/README.md | 7 ++++--- .../coder/modules/devcontainers-cli/main.tf | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/registry/coder/modules/devcontainers-cli/README.md b/registry/coder/modules/devcontainers-cli/README.md index bb5ec6de..771be25d 100644 --- a/registry/coder/modules/devcontainers-cli/README.md +++ b/registry/coder/modules/devcontainers-cli/README.md @@ -14,8 +14,9 @@ The devcontainers-cli module provides an easy way to install [`@devcontainers/cl ```tf module "devcontainers-cli" { - source = "registry.coder.com/coder/devcontainers-cli/coder" - version = "1.0.34" - agent_id = coder_agent.example.id + source = "registry.coder.com/coder/devcontainers-cli/coder" + version = "1.1.0" + agent_id = coder_agent.example.id + start_blocks_login = false } ``` diff --git a/registry/coder/modules/devcontainers-cli/main.tf b/registry/coder/modules/devcontainers-cli/main.tf index a2aee348..16fa35fe 100644 --- a/registry/coder/modules/devcontainers-cli/main.tf +++ b/registry/coder/modules/devcontainers-cli/main.tf @@ -14,10 +14,17 @@ variable "agent_id" { description = "The ID of a Coder agent." } -resource "coder_script" "devcontainers-cli" { - agent_id = var.agent_id - display_name = "devcontainers-cli" - icon = "/icon/devcontainers.svg" - script = templatefile("${path.module}/run.sh", {}) - run_on_start = true +variable "start_blocks_login" { + type = bool + default = false + description = "Boolean, This option determines whether users can log in immediately or must wait for the workspace to finish running this script upon startup." +} + +resource "coder_script" "devcontainers-cli" { + agent_id = var.agent_id + display_name = "devcontainers-cli" + icon = "/icon/devcontainers.svg" + script = templatefile("${path.module}/run.sh", {}) + run_on_start = true + start_blocks_login = var.start_blocks_login }