Auto-generated
This page is generated by terraform-docs at build time from the infra/ repo. Do not edit manually.
Dashboard Portal (core-portal)¶
ECS service for the React dashboard (cookiehub-com/core-portal), deployed behind the public ALB on its own hostname while the Laravel dashboard keeps the canonical one. Mirrors the core-api service shape: own ECR repository, bridge-mode EC2 task with dynamic port mapping, /health target group, and a GitHub Actions OIDC deploy role.
The app is a BFF with no secrets of its own — it holds no database and no keys; every credentialed call is the browser's own session cookie relayed to core-api. So there are no SSM parameters here, and the task takes plain environment variables only.
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.6.0 |
| aws | ~> 6.0 |
Providers¶
| Name | Version |
|---|---|
| aws | ~> 6.0 |
Modules¶
No modules.
Resources¶
| Name | Type |
|---|---|
| aws_cloudwatch_log_group.portal | resource |
| aws_ecr_repository.portal | resource |
| aws_ecs_service.portal | resource |
| aws_ecs_task_definition.portal | 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_role_policy | resource |
| aws_lb_listener_rule.portal | resource |
| aws_lb_target_group.portal | resource |
| aws_route53_record.portal | resource |
| aws_ecs_task_definition.portal | data source |
| 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_zone_id | Canonical hosted zone ID of the public ALB (for Route53 alias) | string |
n/a | yes |
| base_tags | Base tags applied to all resources | map(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 |
| core_api_url | Base URL of core-api, the only upstream the BFF calls (e.g. 'https://core-api.stage.cookiehub.net') | string |
n/a | yes |
| 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, allowing stop-before-start. | number |
100 |
no |
| desired_count | Desired number of ECS tasks | number |
1 |
no |
| 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/core-portal" |
no |
| github_repo_immutable | The repository's immutable-ID OIDC sub form (org@org_id/repo@repo_id) — what repos created since GitHub's immutable-ID rollout actually send as their sub prefix. Read it from gh api repos/<org>/<repo>/actions/oidc/customization/sub (.sub_claim_prefix). Empty skips the extra trust entry (older repos send the classic form). |
string |
"cookiehub-com@77645153/core-portal@1354966618" |
no |
| hostname | Public-facing hostname (e.g. 'dash-next.stage.cookiehub.net'). Must be covered by a certificate already on the HTTPS listener — this module attaches none. | string |
n/a | yes |
| 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 |
| task_cpu | CPU units for the ECS task | number |
512 |
no |
| task_memory | Memory in MB for the ECS task | number |
512 |
no |
| trusted_proxies | Comma-separated IPs/CIDRs of our own forwarding hops — the subnets the public ALB's ENIs sit in. Only from a peer in this list does the server honour X-Forwarded-Proto when deriving request.url; empty (the default) trusts nothing and leaves the URL as the socket reported it. Without it every browser form POST is refused by React Router's CSRF check, which compares full origins scheme-included (CH-466). | 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-portal |
| 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 |