Skip to content

feat(aws-ec2-instance-type): add AWS EC2 instance type parameter module - #1136

Draft
phorcys420 wants to merge 8 commits into
mainfrom
phorcys/aws-ec2-instance-type
Draft

phorcys420 wants to merge 8 commits into
mainfrom
phorcys/aws-ec2-instance-type

Conversation

@phorcys420

Copy link
Copy Markdown
Member

AWS EC2 Instance Type

Adds a coder_parameter helper module that presents AWS EC2 instance types with human-readable specs, following the same pattern as coder/aws-region and whizus/exoscale-instance-type.

Instance types are grouped into purpose-based categories (general, compute, memory, storage, gpu). The module exposes default, mutable, type_category, exclude, custom_names, custom_descriptions, and coder_parameter_order, with a single value output.

Every instance type currently offered by the AWS templates (t3.microt3.2xlarge, used by aws-linux, aws-windows, and aws-envbuilder) is part of the default general category, so the module can back those templates. A test asserts that coverage.

Usage

module "aws_ec2_instance_type" {
  count   = data.coder_workspace.me.start_count
  source  = "registry.coder.com/coder/aws-ec2-instance-type/coder"
  version = "1.0.0"
  default = "t3.micro"
}

resource "aws_instance" "dev" {
  instance_type = module.aws_ec2_instance_type.value
}

Checks

  • terraform fmt, terraform validate, terraform test (8/8 pass)
  • prettier --check
  • readmevalidation
Decision log
  • Coverage: Surveyed every AWS template in coder/registry (aws-linux, aws-windows, aws-envbuilder) and coder/coder (aws-linux, aws-windows, aws-devcontainer, aws-multi-agent). All expose only t3.microt3.2xlarge, so those six are guaranteed present in the default general category and pinned by a test.
  • Structure: Mirrors exoscale-instance-type — purpose-based categories, type_category filter, exclude, custom_names/custom_descriptions, dynamic "option", and a value output.
  • Families: Curated to common current-generation picks rather than the full EC2 catalog: general = t3 + m5, compute = c5, memory = r5, storage = i3, gpu = g4dn. vCPU/RAM values were verified against AWS documentation (g4dn GPU counts and i3 fractional memory double-checked).
  • Option labels: name is the instance ID and description is the spec string, so the picker shows both; both are overridable via custom_names/custom_descriptions.
  • Defaults: default = "" (no preselection), matching aws-region and exoscale-instance-type.
  • Tests: Native .tftest.hcl (required by AGENTS.md); the optional main.test.ts is omitted since the native tests fully cover this parameter-only module.
  • Metadata: verified: false, initial version 1.0.0.

🤖 Opened by Coder Agents on behalf of @phorcys420.

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/aws-ec2-instance-type: first scorecard, 89 / 100

No existing scorecard discussion found for AWS EC2 Instance Type; this is the initial score. A dedicated discussion is created after merge.

Full scorecard for this PR
Presentation & Onboarding Credential Hygiene Restricted-Environment Readiness Engineering Quality Overall
12 / 17 20 / 20 N/A 10 / 10 89 / 100
Drilldown

Presentation & Onboarding — 12 / 17

Criterion Max Score Notes
Configuration-mode examples 12 12 README provides documented examples for all major modes: basic usage, restrict to category, customize names/descriptions, exclude instance types, architecture-aware provisioning, and use without parameter (create_parameter = false). Each example includes sensible defaults and clear context.
Visual preview 5 0 No image, GIF, or video in README. The icon reference points to an external SVG but is not embedded as a visual preview of the module in action.

Credential Hygiene — 20 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 16 Module has no secret inputs. It is a parameter helper that exposes AWS EC2 instance type metadata; no credentials are involved. Full credit as the concern does not apply.
Non-hardcoded auth path 4 4 No authentication required. The module provides a static catalog of instance types and creates a coder_parameter; it does not interact with AWS APIs or require credentials. Full credit as the concern does not apply.

Restricted-Environment Readiness — N/A

Criterion Max Score Notes
Mirrorable artifact source 5 N/A Module downloads nothing. It reads a static JSON file bundled with the module (instance-types.json) and creates a Coder parameter. No external downloads or installs occur.
Bring-your-own binary 10 N/A Module installs nothing. It is a pure Terraform data transformation module that exposes AWS instance type metadata.
Egress transparency 3 N/A Module contacts no external endpoints. It operates entirely on local data (bundled JSON) and Coder API calls implicit to coder_parameter.
Runs without sudo 2 N/A Module contains no scripts. It is pure Terraform HCL with no install or runtime scripts.

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All inputs have clear descriptions. Sensible defaults provided (display_name, description, create_parameter = true, mutable = false, type_category = ["general"]). The type_category variable documents allowed values in its description. The exclude variable shows example format. No validation blocks present, but the input types and defaults are appropriate for the use case.
Test coverage 4 4 The module includes .tftest.hcl with comprehensive test coverage: tests for default behavior, category filtering, exclusions, custom names/descriptions, architecture lookups, and create_parameter = false mode. Tests verify both the parameter creation and the instances catalog output. Clear testing story for business logic.

Overall — 89 / 100

Raw 42 / 47 → round(42 / 47 × 100) = 89

(Normalized from Utility track: Universal criteria only, with Restricted-Environment Readiness marked N/A as the module downloads nothing and runs no scripts. Final score rounds to 89, but recalculating: 42/47 = 0.8936... × 100 = 89.36 → 89. However, checking the math: 12 + 20 + 10 = 42 out of 17 + 20 + 10 = 47. 42/47 = 0.893617 × 100 = 89.36 rounds to 89. Adjusting overall to 89.)

Overall: 89 / 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.

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