Files
acdl/modules-ir/l1/l1-ecs-service/README.md
T
Jon Chery 4ed2542ecf docs(P13): plan-as-execute + verify (v1.2.3)
---ci---
project: acdl
phase: 13
milestone: v1.2
status: verify
verdict: VERIFIED
requirements:
  covered: [REQ-31]
---/ci---

Phase 13 plan-as-execute + verify. scripts/verify_phase13.sh green.
6 ECS L1s authored + registered (l1-vpc, l1-ecs-cluster, l1-ecs-service,
l1-iam-role, l1-alb, l1-ecr). Adapter generalized to table-driven
TYPE_MAP (12 IR types) + INPUT_MAP + OUTPUT_MAP. S3 regression: the v1.1
spike l1-s3 produces byte-identical main.tf. Ready to ship v1.2.3.
2026-07-21 21:05:48 +00:00

2.8 KiB

l1-ecs-service — ECS Fargate service primitive (multi-resource L1)

An L1 module for an ECS Fargate service (task definition + service). Substrate-agnostic (the IR types are aws:ecs:task_definition and aws:ecs:service, not Terraform resource types). This is a multi-resource L1: the interface declares the group's inputs/outputs plus a resources array listing the IR types it emits. The IR instance (Phase 14/15) will have multiple resources entries all with module: "l1-ecs-service@1.0.0".

Interface (the IR-typed contract)

See interface.json: inputs image (string, ECR image URL), port (number), cpu (number, default 256), memory (number, default 512), env (optional JSON map string), cluster_arn (arn, ref to l1-ecs-cluster), subnets (string, ref to l1-vpc), security_group (string), lb_target_group_arn (arn, optional, ref to l1-alb), region (string); outputs service_arn (arn) + task_def_arn (arn); no NFRs.

The resources array lists the emitted IR types:

  • aws:ecs:task_definition — Fargate task definition. The adapter jsonencodes image/port/env into container_definitions.
  • aws:ecs:service — Fargate service running the task definition in the cluster + subnets (+ optional ALB target group wiring).

IR → Terraform mapping (performed by the adapter)

The Terraform adapter (adapters/terraform/adapter.py) translates each emitted IR resource to Terraform:

IR Terraform
resource.type = aws:ecs:task_definition resource "aws_ecs_task_definition" "<id>" { ... }
resource.inputs.image + port + env container_definitions = jsonencode(...) (adapter-built)
resource.inputs.cpu cpu = <value> arg
resource.inputs.memory memory = <value> arg
resource.outputs.task_def_arn output "task_def_arn" { value = aws_ecs_task_definition.<id>.arn }
resource.type = aws:ecs:service resource "aws_ecs_service" "<id>" { ... }
resource.inputs.cluster_arn cluster = <value> arg (identity)
resource.inputs.subnets network_configuration { subnets = [...] } (emit as-is)
resource.inputs.security_group network_configuration { security_groups = [...] } (emit as-is)
resource.inputs.lb_target_group_arn load_balancer { target_group_arn = <value> } (emit as-is)
resource.outputs.service_arn output "service_arn" { value = aws_ecs_service.<id>.id }

The adapter is a thin layer (ARCHITECTURE.md §12.2); it does not own L1 content — it only translates. The container_definitions JSON is built by the adapter from the IR image/port/env inputs (the one transformation the adapter owns for ECS task definitions).

Versioning (W3.D)

1.0.0 — interface MAJOR, behavior MINOR, lifecycle PATCH. MAJOR bumps require a new registry entry (immutable publication); old entries enter a 12-month deprecation window.