Auto-generated
This page is generated by terraform-docs at build time from the infra/ repo. Do not edit manually.
Edge API¶
ECS service for the Edge API. User-facing event ingestion and identity service. Deployed behind CloudFront (for geo headers) → public ALB. Reads from ClickHouse for consent lookup, queues events to SQS.
Built to survive the loss of a node (IS-81): one task per node across AZs (spread + distinctInstance), a 30 s deregistration delay and an explicit stopTimeout. Node replacement is drained by the cluster's capacity provider (modules/edge/ecs). Run it with desired_count >= 2 on >= 2 nodes.
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.6.0 |
| aws | ~> 6.0 |
Providers¶
| Name | Version |
|---|---|
| aws | ~> 6.0 |
Modules¶
No modules.
Resources¶
Inputs¶
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| alb_dns_name | DNS name of the public ALB (CloudFront origin) | string |
n/a | yes |
| alb_https_listener_arn | ARN of the public ALB HTTPS listener | string |
n/a | yes |
| alb_security_group_id | Security group ID of the public ALB | string |
n/a | yes |
| base_tags | Base tags to apply to all resources | map(string) |
{} |
no |
| clickhouse_security_group_id | Security group ID of the ClickHouse instance (ingress rule for edge ECS will be added) | string |
n/a | yes |
| cloudfront_certificate_arn | ACM certificate ARN in us-east-1 for the dedicated edge-api.{zone} CloudFront distribution. Required when create_dedicated_hostname = true; ignored otherwise. |
string |
null |
no |
| cluster_arn | ARN of the ECS cluster to deploy the service into. Must be passed as ARN (not name) — aws_ecs_service.cluster is a force-new attribute and Terraform treats ARN and name as different values. | string |
n/a | yes |
| container_memory_reservation | Soft memory limit (MiB) for the container. Used by ECS for task placement on EC2. Set lower than task_memory to allow multiple task slots to fit on the host during rolling deploys (e.g. 4 tasks × reservation must fit in instance RAM). | number |
null |
no |
| container_stop_timeout | Seconds ECS waits after SIGTERM before SIGKILL when stopping the edge-api container (stopTimeout). | number |
30 |
no |
| create_dedicated_hostname | When true (default), provisions a CloudFront distribution + Route53 A record for edge-api.{zone} fronting the ALB. Set to false when theservice is reached exclusively via external CloudFront distributions (e.g. prod routes everything through consent.cookiehub.net), so no dedicated hostname or edge-api-specific CloudFront is created. |
bool |
true |
no |
| deregistration_delay | Seconds the ALB keeps a deregistering edge-api target draining before ECS stops the task. | number |
30 |
no |
| desired_count | Desired number of ECS tasks. At least 2 for node-loss tolerance; tasks are placed one per node (distinctInstance), so the cluster needs at least this many nodes | number |
1 |
no |
| ecr_repository_arn | ECR repository ARN for the edge-api image, used in the exec role's pull policy | string |
n/a | yes |
| ecr_repository_url | ECR repository URL for the edge-api image (e.g. module.edge_ecr.edge_api_repository_url) |
string |
n/a | yes |
| ecs_security_group_id | Security group ID of ECS tasks (ingress rule for ALB will be added to it) | string |
n/a | yes |
| environment | Environment name | string |
n/a | yes |
| github_oidc_refs | Subject conditions for the deploy role's trust policy, each appended to repo:<org>/<repo>:. A list rather than a string because a job that declares an environment: presents environment:<name> as its subject instead of ref:<git ref>, so a role fronting a gated production deploy has to trust both forms or the assume-role fails. Stage deploys present ref:refs/heads/main (a workflow_run job always reports the default branch); prod release deploys present ref:refs/tags/v*. |
list(string) |
[ |
no |
| github_repo | GitHub repository (org/repo) allowed to deploy via OIDC | string |
"cookiehub-com/edge-api" |
no |
| group | Resource group | string |
n/a | yes |
| host_headers | Host headers the ALB listener rule matches to forward traffic to the edge-api target group. Empty list (default) derives a single-entry list of ["edge-api.{zone}"] — the stage pattern. Override in environmentswhere edge-api is reached exclusively through external hostnames (e.g. prod uses consent/ds/consent-eu/region-eu). |
list(string) |
[] |
no |
| image_tag | ECR image tag Terraform's task-definition revision references. Deploys register their own revisions and the service follows the newest ACTIVE one, so this only matters for the first deploy and for revisions Terraform registers after a task change. | string |
"latest" |
no |
| name_prefix | Prefix for resource names | string |
n/a | yes |
| region | AWS region | string |
n/a | yes |
| sqs_queue_arn | ARN of the SQS queue for event ingestion | string |
n/a | yes |
| task_cpu | CPU units for the ECS task | number |
512 |
no |
| task_memory | Hard memory limit (MiB) for the container. Container is OOM-killed if it exceeds this. | number |
512 |
no |
| vpc_id | VPC ID (used for the ALB target group) | string |
n/a | yes |
| zone_id | Route53 hosted zone ID | string |
n/a | yes |
Outputs¶
| Name | Description |
|---|---|
| cloudfront_distribution_id | CloudFront distribution ID. Null when create_dedicated_hostname = false. |
| cloudfront_domain_name | CloudFront distribution domain name. Null when create_dedicated_hostname = false. |
| gh_deploy_role_arn | ARN of the GitHub OIDC deploy role for edge-api |
| target_group_arn | ARN of the ALB target group for the edge-api service |
| target_group_arn_suffix | Target group ARN suffix, used as the TargetGroup CloudWatch dimension. |