--- phase: 15 name: consumer-repo-and-terraform-apply milestone: v1.2 requirements: [REQ-33, REQ-34] type: feat/deploy branch: phase/15-consumer-repo-and-terraform-apply --- # Phase 15 — consumer-repo-and-terraform-apply (v1.2) PLAN ## Goal Create the consumer repo `acdl-consumer-microservice` with a basic HTTP microservice (Dockerfile + ECR push) and lift the platform from `plan` to `apply` (dev, autonomous). Submit `contracts/microservice.yaml` → pipeline → IR → plan → apply → a real ECS Fargate service running. ## Escalation note `ACDL_GITEA_TOKEN` is not set in this environment — the Gitea API cannot create the consumer repo. Per full-autonomy + the `deploy` escalation hook: the consumer repo *content* is authored locally under `consumer-repos/acdl-consumer-microservice/` (a new top-level dir in the acdl repo as a staging area). The Gitea repo creation + push is a documented manual step (the content is ready; only the remote creation is blocked). The `terraform apply` (the substantive deliverable for REQ-33) proceeds — AWS creds are available (`acdl-spike-runner` verified). ## Tasks ### T-15.1 — Consumer microservice content (REQ-34) Create `consumer-repos/acdl-consumer-microservice/` with: - `app.py` — a tiny Python HTTP server (stdlib `http.server`) returning 200 on `/` with a JSON body `{"status":"ok","service":"acdl-microservice"}`. - `Dockerfile` — `FROM python:3.12-slim`, COPY app.py, `CMD ["python","/app.py"]`, EXPOSE 8080. - `requirements.txt` — empty (stdlib only). - `README.md` — how to build + push to ECR + the contract reference. - `contracts/microservice.yaml` — symlink or copy of the platform's `contracts/microservice.yaml` (the consumer's contract submission). ### T-15.2 — ECR push (REQ-34) Build the Docker image + push to ECR (`581513795199.dkr.ecr.us-east-1.amazonaws.com/acdl-microservice`). Requires `docker` — if unavailable, document the build+push as a manual step and use a placeholder image URL in the contract. The `l1-ecr` L1 creates the ECR repo on apply. ### T-15.3 — terraform apply (REQ-33) Run the full pipeline: `contracts/microservice.yaml` → resolver → adapter → `terraform init` + `terraform plan` + `terraform apply` (dev, autonomous, confidence ≥ 0.50) against real AWS. The apply creates: VPC + subnets + route table + IGW, ECS cluster, ECR repo, IAM role, ALB + target group + listener, ECS task definition + service. Capture the apply output. Write an evidence event to the DynamoDB outbox. ### T-15.4 — Verify the service is live After apply, verify the ECS service is running + the ALB returns HTTP 200 on `/`. (Requires the ALB DNS — extract from the terraform output.) If docker/ECR push wasn't possible, the task definition references a placeholder image and the ECS service may fail to start — document this as a partial completion (the infra is provisioned; the image is the manual step). ## Verification - `consumer-repos/acdl-consumer-microservice/` has app.py + Dockerfile + README.md + contracts/microservice.yaml. - `terraform apply` ran against real AWS (apply output captured). - Evidence event written to DynamoDB outbox. - `scripts/verify_phase15.sh`. ## Ship Merge → `main` (--no-ff). Tag `v1.2.5`.