Skip to content

dynamic parameters: script or code as a form_type option #745

Open
@stirby

Description

@stirby

Proposal

Some customers want a larger text area in the workspace create so users may enter their scripts.

I think we should add a sibling to textarea that renders in monospace and displays line numbers.

I don't think embedding a text editor is necessary.

Example

data "coder_parameter" "setup_script" {
  name         = "setup_script"
  description  = "Commands that run after your workspace is provisioned."
  mutable      = true
  display_name = "Workspace setup script"

  # Renders as a code editor with syntax highlighting
  form_type = "code"
  type      = "string"

  # <<-EOT lets us indent the body but strips the extra leading tabs/spaces
  default = <<-EOT
    #!/usr/bin/env bash
    # This script is executed once the workspace starts.
    # You can install packages, pull dotfiles, or do any other bootstrap tasks.

    set -euo pipefail

    echo "🔄 Updating APT cache…"
    sudo apt-get update -y

    echo "📦 Installing baseline packages…"
    sudo apt-get install -y tmux ripgrep fd-find

    echo "⬇️  Cloning dotfiles repository (replace with your own)…"
    if [ ! -d "$HOME/.dotfiles" ]; then
      git clone https://github.com/your-github-handle/dotfiles.git "$HOME/.dotfiles"
      "$HOME/.dotfiles/install.sh"
    fi

    echo "✅ Workspace bootstrap complete!"
  EOT
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions