> **Page index:** https://km.oslo.systems/llms.txt lists every page on this site, with a link to its Markdown version.

# `app`

ECS service that runs a containerized application.

## Usage

See [Create a new application](<https://km.oslo.systems/application/container/create-new-application/>) in the Golden Path documentation.

## Variables

| Name | Description | Type | Default | Required |
| --- | --- | --- | --- | --- |
| `AppName` | Application name. Used to name the ECS service and related resources. | `string` | `n/a` | yes |
| `AppReadOnlyRootFileSystem` | Make the container's root filesystem read-only, so the app can only write to mounted volumes. | `bool` | `false` | no |
| `AppEcsExec` | Let you open an interactive shell in the running container with the AWS CLI (Amazon ECS Exec). | `bool` | `false` | no |
| `ExampleImage` | Run a public Nginx example image instead of your own application image. Useful for verifying that the infrastructure works before your own image and deployment pipeline exist. Cannot be combined with `DeploymentPipelineV2`. | `map` | `{"Enable": false}` | no |
| `AlbHostRouting` | Expose the app through the environment's shared load balancer. `Subdomain` serves it at `https://<AppName>.<Environment>.oslo.systems`, `ApexDomain` at `https://<AppName>.oslo.kommune.no`. `Internal` uses the environment's internal load balancer instead of the public one. `TargetGroupTargetStickiness` keeps a visitor on the same container for 24 hours, using a load balancer cookie. | `map` | `{"Enable": false, "Internal": true, "Subdomain": {"Enable": false, "TargetGroupTargetStickiness": false}, "ApexDomain": {"Enable": false, "TargetGroupTargetStickiness": false}}` | no |
| `DatabaseConnectivity` | Give the app network access to the environment's database (created by the `databases` template), and inject the database endpoint into the container as the `DB_ENDPOINT` environment variable. Does not create a database. | `map` | `{"Enable": false}` | no |
| `OpenTelemetrySidecar` | Deprecated: use `TelemetryCollection` instead. Adds a sidecar that scrapes the app's Prometheus metrics from `/metrics` and sends them, along with container metrics, to the environment's Amazon Managed Prometheus workspace. | `map` | `{"Enable": false}` | no |
| `DeploymentPipelineV2` | Deploy the app with the next-generation deployment pipeline. Replaces `IamForCicd` and `Ecr`. | `map` | `{"Enable": false}` | no |
| `TelemetryCollection` | Send the app's logs, traces and metrics to Datadog. `AutoInstrumentation` instruments the app automatically at startup (currently Java only). `DatadogAgent` adds container-level monitoring. | `map` | `{"Enable": false, "AutoInstrumentation": {"Enable": false, "Runtime": "java"}, "DatadogAgent": {"Enable": false}}` | no |
| `Xray` | Deprecated: use `TelemetryCollection` instead. Sends traces to AWS X-Ray. | `map` | `{"Enable": false}` | no |
| `VpcEndpoints` | Keep the app's outbound traffic inside the VPC by using the environment's VPC endpoints instead of the internet. Requires VPC endpoints in the `networking` stack; does not create them. | `map` | `{"Enable": false}` | no |
| `ServiceConnect` | Let this app and other Service Connect-enabled services in the ECS cluster reach each other at `http://<AppName>:<port>` (Amazon ECS Service Connect). | `map` | `{"Enable": false}` | no |
| `DailyShutdown` | Stop the app every day at 16:00 UTC and start it again at 06:00 UTC. Saves money in environments that aren't used outside working hours, and follows the Green Software Foundation pattern [Scale down applications when not in use](<https://patterns.greensoftware.foundation/operations/capacity-management/scale-down-unused-applications/>). | `map` | `{"Enable": false}` | no |
| `IamForCicd` | Deprecated: use `DeploymentPipelineV2` instead. Creates IAM roles for GitHub Actions: one for pushing images from the app repository (`AppGitHubRepo`), one for running Terraform from the IaC repository (`IacGitHubRepo`). `EcsDeployFromAppRepo` also lets the app repository trigger deployments. `AssumableCdRole` adds a role for debugging deployment permissions. | `map` | `{"Enable": false, "AppGitHubRepo": null, "IacGitHubRepo": null, "AssumableCdRole": false, "EcsDeployFromAppRepo": false}` | no |
| `DeploymentCircuitBreaker` | Stop a deployment if the new version repeatedly fails to start or become healthy, and roll back to the last working version. | `map` | `{"Enable": false}` | no |
| `Ecr` | Deprecated: use `DeploymentPipelineV2` instead. Pulls the container image from the app's ECR repository (created by the `app-data` template). If disabled, set `image_uri` in `config_override.tf`. | `map` | `{"Enable": true}` | no |

## `app-data`

This template also installs the `app-data` template into its own stack directory, next to this one.

Data resources for the `app` template, such as the ECR repository and the log groups. The `app` template installs it.

### Variables (`app-data`)

No variables defined.
