Command Palette

Search for a command to run...

Hectal
Stage 5 / 7

Modules

Turn ShopLite's growing pile of .tf files into reusable modules — extracted with zero downtime, designed with typed interfaces, versioned, and instantiated with for_each.

ShopLite's `infra/` folder now has over twenty files, and adding a second service would mean copying another hundred lines. Modules are Terraform's unit of reuse: a folder of `.tf` files with inputs and outputs, called from somewhere else. This stage extracts the network into a module without touching a single real resource, designs a service module good enough to run both the API and a new background worker, versions modules like software, and scales them out with `for_each`.

+ ShopLite gains: a network module, an ecs-service module running the API and a new worker, git-tagged module versions, and services defined as a single map

0/4 · 0%
  1. 5.1

    Extract the Network into a Module — Without Touching a Resource

    All VPC, subnet, routing, NAT, and endpoint resources live in `modules/network`, the root calls it once, and the refactor applies with `0 to add, 0 to change, 0 to destroy`.

    50 minFree2 break-its
  2. 5.2

    Design a Reusable ECS Service Module

    One `ecs-service` module with a typed interface — optional load balancer, optional autoscaling knobs with defaults, env/secret maps — running both the ShopLite API and a new background worker.

    60 min+ ~$0.01/hour for one worker task2 break-its
  3. 5.3

    Module Sources, Versions, and the Public Registry

    ShopLite's modules are consumed by pinned git tag instead of a moving local path, and you can evaluate a community Registry module against your own before choosing.

    35 minFree (the Registry comparison is plan-only)2 break-its
  4. 5.4

    Services as Data: for_each over Modules

    All ShopLite services are declared in one map; a single module block with `for_each` creates them, and moving from two named calls to the map is a zero-change plan.

    35 minFree2 break-its