Staged Apply
A staged apply ensures processing resources ( SQS
Amazon Simple Queue Service — buffers ingest and reprocess messages between S3/API and the processor Lambda. , processor Lambda
Processor Lambda container — runs PyTECGg calibration per SQS message; adopted when a Batch on Fargate parallel-execution quota increase was rejected. Image from `ghcr.io/platformfuzz/tec-processor-image` mirrored to ECR. , DynamoDB
Amazon DynamoDB — Jobs table tracks reprocessing job status by `job_id` (queued → processing → completed/failed). ) are ready before the EventBridge Scheduler
AWS EventBridge Scheduler — triggers ingest-sync Lambda on a recurring UTC schedule (default: hourly). starts automated ingest. This avoids raw files landing in S3
Amazon Simple Storage Service — data lake bucket for raw ingest and processed TEC output; S3 events trigger processing. before the processor can consume them.
Prerequisites
Section titled “Prerequisites”- Terraform Init completed
- ECR image mirrored
Stage 1 — Processing layer
Section titled “Stage 1 — Processing layer”Create ingest bucket, SQS pipeline, DynamoDB Jobs table, and processor Lambda:
terraform -chdir=terraform apply -var="region=ap-southeast-2" -target=module.processingThis also creates the ingest module resources the processing layer depends on (S3 bucket, notifications).
Stage 2 — Enable ingest scheduler
Section titled “Stage 2 — Enable ingest scheduler”When processing is healthy, enable scheduled ingest:
terraform -chdir=terraform apply -var="region=ap-southeast-2" -target=module.ingest_schedulerStage 3 — Full reconciliation
Section titled “Stage 3 — Full reconciliation”Apply the remaining resources (presentation, observability, and any drift):
terraform -chdir=terraform apply -var="region=ap-southeast-2"Type yes to confirm. Terraform creates resources in dependency order:
- Ingest layer (S3, ingest-sync Lambda)
- Processing layer (SQS, DynamoDB, ECR, processor Lambda)
- Presentation layer (API Lambdas, API Gateway, Amplify app)
- Portal build + manual Amplify deploy (when
deploy_amplify_on_apply=true)
Skip Amplify on apply
Section titled “Skip Amplify on apply”If Node.js is unavailable in your CI environment:
terraform -chdir=terraform apply -var='deploy_amplify_on_apply=false' -var="region=ap-southeast-2"Deploy the portal manually — see Amplify Portal.
Single-shot alternative
Section titled “Single-shot alternative”If you prefer one apply (after ECR sync):
terraform -chdir=terraform apply -var="region=ap-southeast-2"Staged apply is recommended for first-time deploys to control when automated ingest begins.
Verify apply outputs
Section titled “Verify apply outputs”terraform -chdir=terraform outputterraform -chdir=terraform output -raw api_urlterraform -chdir=terraform output -raw bucket_nameterraform -chdir=terraform output -raw processor_image_uriSee Terraform Outputs for all output values.
Next steps
Section titled “Next steps”- Amplify Portal — confirm portal deployment
- Verification — end-to-end checks