refactor(templates): use aws-region module in aws-linux and aws-windows - #1137
Draft
phorcys420 wants to merge 1 commit into
Draft
phorcys420 wants to merge 1 commit into
phorcys420 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts the maintained
aws-regionmodule in theaws-linuxandaws-windowsstarter templates, replacing the duplicated hand-rolledcoder_parameter "region"block. This matches whataws-envbuilderalready does and drops ~90 lines of duplicated region option data per template.Changes (per template)
regioncoder_parameter(17 static options) withmodule "aws_region"(pinned~> 1.0,default = "us-east-1").awsproviderregion, the instanceavailability_zone, and theregionmetadata item tomodule.aws_region.value.Note: parameter key changes
region→aws_regionThe module hardcodes the parameter
name = "aws_region"(the old block usedregion), 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). Thecoder_metadatadisplay item keeps its ownkey = "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 maintainedaws-regionmodule, matchingaws-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.tfandregistry/coder/templates/aws-windows/main.tf. No module version bump (nothing underregistry/**/modules/changes).Module interface:
aws-regionexposesdefault/mutable/exclude/ … inputs and avalueoutput; internally it declaresdata "coder_parameter" "region"withname = "aws_region"and 29 regions. Pinned~> 1.0(same asaws-envbuilder), resolves to1.0.31.Behavior preservation:
us-east-1(set on the module).mutable = falsepreserved (module default).availability_zonekeeps the"<region>a"suffix.Validation:
terraform init+terraform validatepass for both templates;terraform fmtandprettier --checkare clean.Out of scope (separate follow-up): wiring the
windows-rdpmodule intoaws-windows. That template currently has no admin-password plumbing (itsuser_dataonly bootstraps the agent), so addingwindows-rdpmeans introducing arandom_password, setting the Windows Administrator password inuser_data, and passingadmin_username/admin_password— a bigger, template-specific change kept out of this PR.Generated by Coder Agents on behalf of @phorcys420.