IaC repo setup
Set up the infrastructure for a new application in your IaC repository.
Before you begin
This guide assumes
- you have an application repository that contains a single application. For monorepos or repositories containing both application code and Terraform code, contact Utviklerflyt.
- your application can be deployed as a container image. For other application platforms (e.g. static website, Lambda), see section Guides → Other or contact Utviklerflyt.
- you have familiarized yourself with the key points from the risk assessment analysis (ROS).
Step 1: Add package
Update package-config.yml to enable the components you need. You can use the following configuration to set up a
minimal application running on nginx with an internet-facing address:
repo-iac/environments/dev/app-hello-world/package-config.yml
# Attribute reference:
# https://github.com/oslokommune/golden-path-boilerplate/blob/main/boilerplate/terraform/app/boilerplate.yml
StackName: "app-hello-world"
app-data.StackName: "app-hello-world-data"
AppName: "hello-world" # TODO: Set this to the name of your application
AppEcsExec: false
AppReadOnlyRootFileSystem: false
ExampleImage:
Enable: false
Ecr:
Enable: false
ServiceConnect:
Enable: true
AlbHostRouting:
Enable: true
Internal: false
Subdomain:
Enable: true
TargetGroupTargetStickiness: false
DatabaseConnectivity:
Enable: false
DailyShutdown:
Enable: false
DeploymentPipelineV2:
Enable: true
TelemetryCollection:
Enable: false
AutoInstrumentation:
Enable: false
Runtime: java
Step 2: Install the package
Step 3: Add app to cicd-common
Add your application repository to config_override.tf:
repo-iac/environments/dev/cicd-common/config_override.tf
locals {
trusted_repositories = [
# ...
{
name = "<repo-name>"
type = "app"
}
]
}
Update these values:
| Field | Description | Example |
|---|---|---|
<repo-name> |
The name of your application repo | hello-world |
Step 4: Push
Push the code to main/master.
Next steps
The "Terraform apply" GitHub actions workflow will now launch an ECS service, but it has no container image to deploy. To do that, follow the application setup in the next guide: App repo setup