Skip to content

Auto-generated

This page is generated by terraform-docs at build time from the infra/ repo. Do not edit manually.

Core API

ECS service for the CookieHub Core API. Includes its own ECR repository, deployed behind the public ALB with environment-specific hostname and TLS certificate. Handles consent management and client-facing API endpoints.

Requirements

Name Version
terraform >= 1.6.0
aws ~> 5.0

Providers

Name Version
aws ~> 5.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.core_api resource
aws_ecr_repository.core_api resource
aws_ecs_service.core_api resource
aws_ecs_task_definition.core_api resource
aws_iam_openid_connect_provider.github resource
aws_iam_policy.read_ssm resource
aws_iam_role.execution_role resource
aws_iam_role.gh_deploy resource
aws_iam_role.task_role resource
aws_iam_role_policy.gh_deploy resource
aws_iam_role_policy_attachment.execution_read_ssm resource
aws_iam_role_policy_attachment.execution_role_policy resource
aws_lb_listener_certificate.core_api resource
aws_lb_listener_rule.core_api resource
aws_lb_target_group.core_api resource
aws_route53_record.core_api resource
aws_security_group_rule.core_api_to_mariadb resource
aws_ssm_parameter.auth_secret resource
aws_ssm_parameter.database_url resource
aws_ssm_parameter.vault_api_key resource
aws_iam_openid_connect_provider.github data source
aws_iam_policy_document.ecs_assume_role data source

Inputs

Name Description Type Default Required
alb_dns_name DNS name of the public ALB (for Route53 alias target) 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
alb_zone_id Canonical hosted zone ID of the public ALB (for Route53 alias) string n/a yes
base_tags Base tags to apply to all resources map(string) {} no
certificate_arn ARN of the ACM certificate for the hostname string n/a yes
cluster_name ECS cluster name to deploy the service into string n/a yes
container_port Port the container listens on number 3000 no
create_oidc_provider Whether to create the GitHub Actions OIDC provider. True for stage (creates it); false for prod (an account-wide provider already exists and is referenced via data source). bool true no
deployment_maximum_percent ECS rolling-deploy maximum percent. Default 200. Pair with minimum_healthy_percent=0 and set to 100 for stop-before-start on capacity-constrained instances. number 200 no
deployment_minimum_healthy_percent ECS rolling-deploy minimum healthy percent. Default 100 (zero-downtime start-before-stop). Set to 0 where the cluster instance can't fit a second task alongside co-tenants (e.g. prod core shares a t3.small with atrax-api), allowing stop-before-start. number 100 no
desired_count Desired number of ECS tasks number 1 no
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_ref GitHub ref condition for the deploy role's trust policy sub claim. Stage deploys from a branch ('ref:refs/heads/main'); prod deploys from Release tags ('ref:refs/tags/*'). string "ref:refs/heads/main" no
github_repo GitHub repository (org/repo) allowed to deploy via OIDC string "cookiehub-com/core-api" no
hostname Public-facing hostname (e.g. 'core-api.stage.cookiehub.net' or 'api.cookiehub.com') string n/a yes
name_prefix Prefix for resource names string n/a yes
rds_security_group_id Security group ID of the MariaDB RDS instance (ingress rule for ECS will be added). Empty string skips the ingress rule — used in prod, where the core DB is the legacy non-Terraform MariaDB wired separately. string "" no
region AWS region string n/a yes
task_cpu CPU units for the ECS task number 512 no
task_memory Memory in MB for the ECS task number 512 no
vault_api_url Base URL of the vault-api service for consent analytics (e.g. 'https://vault-api.internal.stage.cookiehub.net'). Empty disables the integration — vault-backed endpoints return 503. string "" 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
ecr_repository_url ECR repository URL for core-api
target_group_arn ARN of the ALB target group
target_group_arn_suffix ARN suffix of the ALB target group (TargetGroup CloudWatch dimension), for monitoring alarms