Make each Coder template self-contained (fix coder templates push failure)
Provision Coder Templates / provision (push) Successful in 2m10s

coder templates push -d templates/<env> only uploads that directory to the
Coder server, so main.tf's file() references reaching outside it via
../../profile-templates and ../../scripts failed at push/apply time
("Invalid function argument ... this function works only with files that
are distributed as part of the configuration source code"). Confirmed via
an actual failed run of coder-templates.yml once the runner network fix let
it get that far.

Fix: duplicate profile.code-profile, cli-setup-wizard.sh, and
install-skills.sh into each templates/<env>/ directory and drop the old
shared scripts/ and profile-templates/ directories.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 16:52:12 +02:00
parent 5b32539d65
commit 22429aa4e3
26 changed files with 938 additions and 55 deletions
+5 -5
View File
@@ -11,7 +11,7 @@ terraform {
locals {
env_name = "TTRPG & Lore Building"
profile = jsondecode(file("${path.module}/../../profile-templates/TTRPG.code-profile"))
profile = jsondecode(file("${path.module}/profile.code-profile"))
settings_raw = jsondecode(local.profile.settings).settings
extensions = [for e in jsondecode(local.profile.extensions) : e.identifier.id]
}
@@ -243,7 +243,7 @@ resource "coder_script" "apply_settings" {
# Drops the shared CLI setup wizard onto the workspace and hooks it into
# every new interactive shell (via .bashrc) until the user completes it.
# See ../../scripts/cli-setup-wizard.sh for what it actually asks.
# See ./cli-setup-wizard.sh for what it actually asks.
resource "coder_script" "cli_setup_wizard" {
agent_id = coder_agent.main.id
display_name = "Install CLI Setup Wizard"
@@ -252,7 +252,7 @@ resource "coder_script" "cli_setup_wizard" {
#!/bin/bash
set -e
mkdir -p /opt/coder
echo '${base64encode(file("${path.module}/../../scripts/cli-setup-wizard.sh"))}' | base64 -d > /opt/coder/cli-setup-wizard.sh
echo '${base64encode(file("${path.module}/cli-setup-wizard.sh"))}' | base64 -d > /opt/coder/cli-setup-wizard.sh
chmod +x /opt/coder/cli-setup-wizard.sh
MARKER="# >>> coder cli setup wizard >>>"
@@ -299,7 +299,7 @@ resource "coder_script" "install_bun" {
# Installs this repo's Agent Skills into Claude Code, GitHub Copilot CLI, and
# Antigravity CLI's skills directories, plus the foundryvtt-modding and
# ttrpg-lore-weaver skills from extensions/custom-specialty-plugin.
# See ../../scripts/install-skills.sh.
# See ./install-skills.sh.
resource "coder_script" "install_skills" {
agent_id = coder_agent.main.id
display_name = "Install Agent Skills"
@@ -308,7 +308,7 @@ resource "coder_script" "install_skills" {
#!/bin/bash
set -e
mkdir -p /opt/coder
echo '${base64encode(file("${path.module}/../../scripts/install-skills.sh"))}' | base64 -d > /opt/coder/install-skills.sh
echo '${base64encode(file("${path.module}/install-skills.sh"))}' | base64 -d > /opt/coder/install-skills.sh
chmod +x /opt/coder/install-skills.sh
SPECIALTY_SKILLS="foundryvtt-modding ttrpg-lore-weaver" /opt/coder/install-skills.sh
EOT