refactor(templates): use aws-region and aws-ec2-instance-type modules across AWS templates - #1137
Open
phorcys420 wants to merge 5 commits into
Open
phorcys420 wants to merge 5 commits into
phorcys420 wants to merge 5 commits 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.
…tput
Replace the hand-rolled instance_type coder_parameter in aws-linux and
aws-windows with the aws-ec2-instance-type module (~> 1.0, default t3.micro),
and bump aws-region to ~> 1.1 to use its new default_availability_zone output
instead of interpolating "${region}a".
The instance_type parameter key changes from `instance_type` to
`aws_ec2_instance_type` (the module hardcodes the name). Default t3.micro is
preserved; the t3 picker gains t3.nano. The availability_zone value is
unchanged ("<region>a").
…-envbuilder Bump aws-envbuilder's aws-region pin to ~> 1.1 and source availability_zone from the new default_availability_zone output, and replace the hand-rolled instance_type coder_parameter with the aws-ec2-instance-type module (~> 1.0, default t3.micro). Mirrors the aws-linux and aws-windows changes. The instance_type parameter key changes from `instance_type` to `aws_ec2_instance_type`; default t3.micro is preserved.
phorcys420
marked this pull request as ready for review
September 28, 2026 23:27
matifali
approved these changes
Sep 29, 2026
matifali
left a comment
Member
There was a problem hiding this comment.
LGTM. Thanks for doing this. Templates look way, more cleaner now.
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-regionandaws-ec2-instance-typemodules across the AWS starter templates (aws-linux,aws-windows,aws-envbuilder), replacing hand-rolledregionandinstance_typecoder_parameterblocks with the shared modules.Per template
regionandinstance_typeparameters withmodule "aws_region"(~> 1.1) andmodule "aws_ec2_instance_type"(~> 1.0).aws_region; bump it~> 1.0→~> 1.1and replace the hand-rolledinstance_typeparameter withmodule "aws_ec2_instance_type"(~> 1.0).Details
availability_zonenow comes from the newmodule.aws_region.default_availability_zoneoutput (added in aws-region v1.1.0) instead of interpolating"${region}a"— identical value.aws-ec2-instance-typedefaults tot3.microwith the defaultinclude = ["t3"]family.Parameter key changes
The modules hardcode their parameter names, so the stable parameter keys change:
region→aws_regioninstance_type→aws_ec2_instance_typeDefaults are preserved (
us-east-1,t3.micro), so fresh builds are unaffected. The region list grows 17 → 29 and the instance-type picker gainst3.nano; the previous options remain a subset, nothing is removed. Thecoder_metadatadisplay items keep their ownkeyvalues, which are unrelated to the parameter names.Context / decision log
Goal: replace the hand-rolled region / instance-type
coder_parameterblocks in the AWS starter templates with the maintainedaws-regionandaws-ec2-instance-typemodules, matchingaws-envbuilder's existing region-module usage and cutting duplicated 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 —
aws-linux,aws-windows, andaws-envbuildermain.tf. No module source changes.Versions:
aws-regionpinned~> 1.1(v1.1.0 introduces thedefault_availability_zoneoutput used here); resolves to1.1.0.aws-ec2-instance-typepinned~> 1.0; resolves to1.0.0.Behavior preservation:
us-east-1, instance typet3.micro;mutable = falsepreserved (module defaults).availability_zone:module.aws_region.default_availability_zonereturns"<region>a", identical to the old interpolation.t3.nano; previous options are subsets, so nothing is removed.Validation:
terraform init+terraform validatepass for all three templates;terraform fmtandprettier --checkare clean.Out of scope (separate follow-up): wiring the
windows-rdpmodule intoaws-windows. That template 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.Solves #1122
Generated by Coder Agents on behalf of @phorcys420.