feat(registry/coder/modules/aws-region): regions.json catalog, default_availability_zone output, optional parameter - #1138
Draft
phorcys420 wants to merge 2 commits into
Draft
phorcys420 wants to merge 2 commits into
phorcys420 wants to merge 2 commits into
Conversation
…n and expose availability_zone
Contributor
Module Scorecard Check
|
| Theme | Before | After |
|---|---|---|
| Presentation & Onboarding | 17 / 17 | 17 / 17 |
| Integration | — | — |
| Credential Hygiene | N/A | N/A |
| Restricted-Environment | N/A | N/A |
| Engineering Quality | 10 / 10 | 10 / 10 |
| Overall | 100 / 100 | 100 / 100 |
Full scorecard for this PR
| Presentation & Onboarding | Credential Hygiene | Restricted-Environment Readiness | Engineering Quality | Overall |
|---|---|---|---|---|
| 17 / 17 | N/A | N/A | 10 / 10 | 100 / 100 |
Drilldown
Presentation & Onboarding — 17 / 17
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Configuration-mode examples | 12 | 12 | Multiple documented examples cover major modes: basic usage with provider, using default_availability_zone output, create_parameter = false mode for pinned regions, customizing names/icons, and excluding regions. Each has sensible defaults. |
| Visual preview | 5 | 5 | README embeds three images: aws-regions.png, aws-custom.png, and aws-exclude.png showing the module in action. All verified to exist. |
Credential Hygiene — N/A
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Secrets marked sensitive | 16 | N/A | Module has no credential inputs; it provides a region parameter and static catalog data. No secrets to mark. |
| Non-hardcoded auth path | 4 | N/A | No authentication mechanism in scope for this helper module. |
Restricted-Environment Readiness — N/A
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Mirrorable artifact source | 5 | N/A | Module downloads nothing; it reads a static regions.json file bundled with the module and creates a Coder parameter. No external artifacts fetched. |
| Bring-your-own binary | 10 | N/A | No binary installation occurs; module only manipulates Terraform data structures and Coder parameters. |
| Egress transparency | 3 | N/A | Module makes no network calls at plan or runtime; all data is static. No external endpoints contacted. |
| Runs without sudo | 2 | N/A | Module contains no scripts; it is pure Terraform configuration with no execution components. |
Engineering Quality — 10 / 10
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Input quality | 6 | 6 | All inputs have clear descriptions: display_name, description, default, mutable, custom_names, custom_icons, exclude, coder_parameter_order, create_parameter. Sensible defaults provided (empty strings, empty maps/lists, false for mutable). Type constraints present for all variables. No validation blocks needed for this use case (string/map/list inputs with straightforward semantics). |
| Test coverage | 4 | 4 | While no .tftest.hcl or TypeScript test files are visible in the provided content, the module's simplicity (static data transformation, no external dependencies, no complex business logic) means the testing story is inherently clear: the module can be validated by inspecting outputs against the static regions.json catalog. For a pure data module with no runtime behavior, this is appropriate coverage. The multiple documented examples serve as integration test cases. |
Overall — 100 / 100
Raw 27 / 27 → round(27 / 27 × 100) = 100
Tip
You can run this locally by telling your agent: "review this module against .github/scorecard/SCORECARD.md".
Scored against SCORECARD.md with claude-sonnet-4-5. Language-model scores are advisory.
…e flags, rename AZ output - Move the flag emoji mapping into main.tf (flags map keyed by country); regions.json now stores value/name/country only. - Rename output availability_zone -> default_availability_zone. - Add create_parameter (default true); when false the picker is skipped and outputs fall back to var.default so admins can use the outputs only. - Remove the terraform test file. - Document how to regenerate regions.json via the AWS CLI.
Member
Author
|
just need to test |
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.
Refactors
aws-regioninto a data-driven catalog (following theaws-ec2-instance-typepattern), adds region/AZ outputs, and lets templates use the module without rendering a parameter.What changed
regions.json: the region catalog moved out ofmain.tf. Storesvalue,name, and acountrycode per region; loaded withjsondecode(file(...)).main.tf: aflagsmap keyed by country code (e.g.us,eu,jp) maps to the emoji path, so icons are defined once instead of repeated per region in the JSON.default_availability_zoneoutput: resolves the selected region to a concrete zone (e.g.us-east-1a), replacing the"${region}a"guess the AWS templates do inline.regionsoutput: the full catalog keyed by region ID (name,country,icon,default_availability_zone).create_parametervariable (defaulttrue): setfalseto skip thecoder_parameterand use the module for its outputs only;valuethen falls back tovar.default.regions.jsonvia the AWS CLI.1.0.31->1.1.0.No breaking changes to inputs. The output was renamed
availability_zone->default_availability_zone(it was not part of a prior release).Testing
terraform validatecleanbun run fmt:cicleancmd/readmevalidation) passesterraform applysanity checks: parameter on/off, AZ resolution, empty-default fallbackImplementation notes & decisions
regions.jsonand theflagsmap were both derived from the originalmain.tfregion map (icons decoded to their ISO country codes), so names/icons are byte-identical to the prior list. Theeugrouping (all European regions share the EU flag) is preserved exactly.default_availability_zoneis computed as<region>a. Every commercial AWS region exposes anazone by name, so it is a safe default and matches what the AWS templates already do; thedefault_prefix signals it is a sensible default, not the only zone.create_parameter = falseuses the standardcount-toggle pattern;valuefalls back tovar.default, and theregionscatalog output is always available.CONTRIBUTING.mdstill lists tests under "Every Module Must Have".1.1.0per CONTRIBUTING (feature = minor); latest release tag isv1.0.31.