How tuyojr/listings-api-infra works
This repository defines AWS infrastructure for the listings API: per-environment Terraform roots compose reusable modules for networking, routing, compute, data, and secrets. The principal runtime path is client traffic through the ALB to the auth and listings ECS services, which use their own RDS databases and scoped secrets. A separate bootstrap script establishes account-level Terraform and app-deployment access. The README also documents app-repository deployment and secret-sync integrations; those are external workflows, not code in this repository, so only their documented interactions are shown.
Main entry points: dev/main.tf Dev stack · prod/main.tf Prod stack · service ECS services · db_bootstrap DB role bootstrap task
Components 18
Environment stacks
- Dev stack
environments/dev/main.tf - Prod stack
environments/prod/main.tf
Network and runtime
- VPC and subnets
modules/network - Application load balancer
modules/alb - ECS cluster
modules/ecs-cluster - ECS services
modules/service - Image repositories
modules/ecr
Data and access
- Auth database
modules/database - Listings database
modules/database - Secrets Manager
modules/secrets - Task IAM roles
modules/iam - DB role bootstrap task
modules/db_bootstrap
Account bootstrap
- Account bootstrap
bootstrap/bootstrap.sh - App deploy role
bootstrap/bootstrap.sh
Other components
- API clients
- App repo workflows
- GitHub OIDC
- Terraform state bucket
Connections 38
- Dev stack → VPC and subnets: instantiates
- Dev stack → Application load balancer: instantiates
- Dev stack → ECS cluster: instantiates
- Dev stack → ECS services: instantiates
- Dev stack → Image repositories: instantiates
- Dev stack → Auth database: instantiates
- Dev stack → Listings database: instantiates
- Dev stack → Secrets Manager: instantiates
- Dev stack → Task IAM roles: instantiates
- Dev stack → DB role bootstrap task: instantiates
- Prod stack → VPC and subnets: instantiates
- Prod stack → Application load balancer: instantiates
- Prod stack → ECS cluster: instantiates
- Prod stack → ECS services: instantiates
- Prod stack → Image repositories: instantiates
- Prod stack → Auth database: instantiates
- Prod stack → Listings database: instantiates
- Prod stack → Secrets Manager: instantiates
- Prod stack → Task IAM roles: instantiates
- Prod stack → DB role bootstrap task: instantiates
- API clients → Application load balancer: sends requests
- Application load balancer → ECS services: routes paths
- ECS services → ECS cluster: runs tasks
- ECS services → Auth database: uses auth database
- ECS services → Listings database: uses listings database
- ECS services → Secrets Manager: reads at startup
- ECS services → Task IAM roles: assumes task role
- DB role bootstrap task → Auth database: bootstraps roles
- DB role bootstrap task → Listings database: bootstraps roles
- DB role bootstrap task → Secrets Manager: reads master secret
- Account bootstrap → Terraform state bucket: creates
- Account bootstrap → GitHub OIDC: configures trust
- Account bootstrap → App deploy role: creates
- App repo workflows → GitHub OIDC: assumes roles
- App repo workflows → Image repositories: pushes images
- App repo workflows → ECS services: updates deployments
- App repo workflows → Secrets Manager: syncs values
- App repo workflows → DB role bootstrap task: runs one-off task