Skip to content

refactor(templates): use aws-region module in aws-linux and aws-windows - #1137

Draft
phorcys420 wants to merge 1 commit into
mainfrom
phorcys/aws-region-module
Draft

phorcys420 wants to merge 1 commit into
mainfrom
phorcys/aws-region-module

Conversation

@phorcys420

Copy link
Copy Markdown
Member

Adopts the maintained aws-region module in the aws-linux and aws-windows starter templates, replacing the duplicated hand-rolled coder_parameter "region" block. This matches what aws-envbuilder already does and drops ~90 lines of duplicated region option data per template.

Changes (per template)

  • Replace the region coder_parameter (17 static options) with module "aws_region" (pinned ~> 1.0, default = "us-east-1").
  • Repoint the aws provider region, the instance availability_zone, and the region metadata item to module.aws_region.value.

Note: parameter key changes regionaws_region

The module hardcodes the parameter name = "aws_region" (the old block used region), so the stable parameter key changes. default = "us-east-1" preserves the same default selection, so fresh builds are unaffected. The region list grows 17 → 29 (the old options are a subset, nothing removed). The coder_metadata display item keeps its own key = "region", which is unrelated to the parameter name.

Context / decision log

Goal: replace the hand-rolled data "coder_parameter" "region" block in the two AWS templates with the maintained aws-region module, matching aws-envbuilder. Consistency + less duplicated region option data. AWS was the only cloud where region-module adoption was inconsistent (every GCP and Azure template already consumes its region module).

Scope: templates only — registry/coder/templates/aws-linux/main.tf and registry/coder/templates/aws-windows/main.tf. No module version bump (nothing under registry/**/modules/ changes).

Module interface: aws-region exposes default / mutable / exclude / … inputs and a value output; internally it declares data "coder_parameter" "region" with name = "aws_region" and 29 regions. Pinned ~> 1.0 (same as aws-envbuilder), resolves to 1.0.31.

Behavior preservation:

  • Default stays us-east-1 (set on the module).
  • mutable = false preserved (module default).
  • availability_zone keeps the "<region>a" suffix.
  • Region list 17 → 29; the original 17 are a subset of the 29, so nothing is removed.
  • No README references the removed parameter, so no README changes were needed.

Validation: terraform init + terraform validate pass for both templates; terraform fmt and prettier --check are clean.

Out of scope (separate follow-up): wiring the windows-rdp module into aws-windows. That template currently has no admin-password plumbing (its user_data only bootstraps the agent), so adding windows-rdp means introducing a random_password, setting the Windows Administrator password in user_data, and passing admin_username / admin_password — a bigger, template-specific change kept out of this PR.


Generated by Coder Agents on behalf of @phorcys420.

Replace the hand-rolled coder_parameter.region (17 static options) in the
aws-linux and aws-windows templates with the maintained aws-region module
(pinned ~> 1.0), matching aws-envbuilder. Repoints the aws provider,
availability_zone, and the region metadata item to module.aws_region.value.

The workspace parameter key changes from `region` to `aws_region` (the module
hardcodes name = "aws_region"); default = "us-east-1" preserves the same
default selection, so fresh builds are unaffected.
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.

1 participant