Skip to content

fix(templates): fix terraform errors#951

Merged
phorcys420 merged 2 commits into
mainfrom
phorcys/fix-template-errors
Jul 8, 2026
Merged

fix(templates): fix terraform errors#951
phorcys420 merged 2 commits into
mainfrom
phorcys/fix-template-errors

Conversation

@phorcys420

Copy link
Copy Markdown
Member

Problem

Now that scripts/terraform_validate.sh validates templates (from #948), running terraform validate across the registry surfaces pre-existing breakages in 14 coder/* templates. This PR fixes all of them so they pass validation.

Fixes

Unsupported agent_name argument (dominant issue)

  • Removed agent_name from code-server / windows_rdp module calls and from coder_app / coder_env / coder_script / coder_agent_instance resources. Only the jetbrains and filebrowser modules actually declare an agent_name variable, so those usages are left intact.

Invalid jetbrains module source

  • registry.coder.com/modules/coder/jetbrains/coder (5 components — invalid) → registry.coder.com/coder/jetbrains/coder.

windows_rdp stray argument

  • Removed resource_id = null (no longer a supported argument).

aws-devcontainer region module

  • Replaced the raw source = "https://registry.coder.com/modules/aws-region" URL with the proper registry source registry.coder.com/coder/aws-region/coder + version = "~> 1.0".

gcp-devcontainer agent reference

  • Fixed module calls referencing the non-existent coder_agent.main; the agent in that template is coder_agent.dev (count-based), so they now use coder_agent.dev[0].id.

incus provider schema drift

  • incus_volumeincus_storage_volume
  • incus_cached_imageincus_image (object-form source_image = { remote, name })
  • Dropped the unsupported incus_instance_file resource; the agent token is now delivered via cloud-init write_files (consistent with how the init script and systemd units are already delivered).
  • Moved instance limits into config (limits.cpu / limits.memory) and updated coder_metadata references accordingly.

Validation

All 14 previously-failing templates now pass terraform validate:

aws-devcontainer, aws-linux, azure-linux, azure-windows, digitalocean-linux,
docker, docker-devcontainer, gcp-devcontainer, gcp-linux, gcp-vm-container,
kubernetes, nomad-docker, scratch, incus  → all Success

terraform fmt / prettier applied. No .terraform artifacts or lockfiles committed.

Note

Changes are confined to template main.tf files. The incus rework in particular adapts to the current lxc/incus provider schema; the token-via-cloud-init approach matches the sibling bpmct/incus-* templates.

Generated with Mux.

Running 'terraform validate' on every template (now enforced by
scripts/terraform_validate.sh) surfaced pre-existing breakages in 14
coder/* templates. Fixes:

- Remove unsupported 'agent_name' argument from code-server / windows_rdp
  module calls and from coder_app / coder_env / coder_script /
  coder_agent_instance resources (agent_name is only valid on the
  jetbrains/filebrowser modules, which are left untouched).
- Correct the jetbrains module source from the invalid 5-component
  'registry.coder.com/modules/coder/jetbrains/coder' to
  'registry.coder.com/coder/jetbrains/coder'.
- Remove the stray 'resource_id = null' argument from windows_rdp.
- aws-devcontainer: use the proper registry source + version for the
  aws-region module instead of a raw https URL.
- gcp-devcontainer: reference the actual agent (coder_agent.dev[0])
  instead of the non-existent coder_agent.main.
- incus: update to the lxc/incus provider schema — incus_volume ->
  incus_storage_volume, incus_cached_image -> incus_image (object
  source_image), drop the unsupported incus_instance_file resource
  (deliver the agent token via cloud-init write_files), and move
  instance limits into config (limits.cpu/limits.memory).

All 14 templates now pass 'terraform validate'.
@phorcys420 phorcys420 changed the title Fix terraform validate errors across coder templates fix(templates): fix terraform errors Jul 8, 2026
@phorcys420 phorcys420 enabled auto-merge (squash) July 8, 2026 15:37
@phorcys420 phorcys420 merged commit 3e9c675 into main Jul 8, 2026
4 checks passed
@phorcys420 phorcys420 deleted the phorcys/fix-template-errors branch July 8, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants