diff --git a/.github/workflows/build-and-push-image.yml b/.github/workflows/build-and-push-image.yml index 1534c962b..8191630f9 100644 --- a/.github/workflows/build-and-push-image.yml +++ b/.github/workflows/build-and-push-image.yml @@ -49,18 +49,32 @@ jobs: name: Deploy '${{ needs.set-env.outputs.branch }}' to ${{ needs.set-env.outputs.environment }} needs: [ set-env ] uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v2.2.0 + strategy: + matrix: + image: [ + "Dockerfile", + "Dockerfile.PersonsApi" + ] + include: + - image: "Dockerfile" + aca_name_secret: "AZURE_ACA_NAME" + name: "tramsapi-app" + - image: "Dockerfile.PersonsApi" + aca_name_secret: "AZURE_PERSONS_API_ACA_NAME" + name: "personsapi-app" with: - docker-image-name: 'tramsapi-app' - docker-build-file-name: './Dockerfile' + docker-image-name: '${{ matrix.name }}' + docker-build-file-name: './${{ matrix.image }}' environment: ${{ needs.set-env.outputs.environment }} - annotate-release: true + # Only annotate the release once, because both apps are deployed at the same time + annotate-release: ${{ matrix.name == 'tramsapi-app' }} docker-build-args: | COMMIT_SHA="${{ needs.set-env.outputs.checked-out-sha }}" secrets: azure-acr-name: ${{ secrets.ACR_NAME }} azure-acr-credentials: ${{ secrets.ACR_CREDENTIALS }} azure-aca-credentials: ${{ secrets.AZURE_ACA_CREDENTIALS }} - azure-aca-name: ${{ secrets.AZURE_ACA_NAME }} + azure-aca-name: ${{ secrets[matrix.aca_name_secret] }} azure-aca-resource-group: ${{ secrets.AZURE_ACA_RESOURCE_GROUP }} create-tag: diff --git a/terraform/README.md b/terraform/README.md index 34411923a..867d1d9e4 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -169,6 +169,7 @@ No resources. | [container\_health\_probe\_path](#input\_container\_health\_probe\_path) | Specifies the path that is used to determine the liveness of the Container | `string` | n/a | yes | | [container\_scale\_http\_concurrency](#input\_container\_scale\_http\_concurrency) | When the number of concurrent HTTP requests exceeds this value, then another replica is added. Replicas continue to add to the pool up to the max-replicas amount. | `number` | `10` | no | | [container\_secret\_environment\_variables](#input\_container\_secret\_environment\_variables) | Container secret environment variables | `map(string)` | n/a | yes | +| [custom\_container\_apps](#input\_custom\_container\_apps) | Custom container apps, by default deployed within the container app environment managed by this module. |
map(object({| `{}` | no | | [dns\_mx\_records](#input\_dns\_mx\_records) | DNS MX records to add to the DNS Zone |
container_app_environment_id = optional(string, "")
resource_group_name = optional(string, "")
revision_mode = optional(string, "Single")
container_port = optional(number, 0)
ingress = optional(object({
external_enabled = optional(bool, true)
target_port = optional(number, null)
traffic_weight = object({
percentage = optional(number, 100)
})
cdn_frontdoor_custom_domain = optional(string, "")
cdn_frontdoor_origin_fqdn_override = optional(string, "")
cdn_frontdoor_origin_host_header_override = optional(string, "")
enable_cdn_frontdoor_health_probe = optional(bool, false)
cdn_frontdoor_health_probe_protocol = optional(string, "")
cdn_frontdoor_health_probe_interval = optional(number, 120)
cdn_frontdoor_health_probe_request_type = optional(string, "")
cdn_frontdoor_health_probe_path = optional(string, "")
cdn_frontdoor_forwarding_protocol_override = optional(string, "")
}), null)
identity = optional(list(object({
type = string
identity_ids = list(string)
})), [])
secrets = optional(list(object({
name = string
value = string
})), [])
registry = optional(object({
server = optional(string, "")
username = optional(string, "")
password_secret_name = optional(string, "")
identity = optional(string, "")
}), null),
image = string
cpu = number
memory = number
command = list(string)
liveness_probes = optional(list(object({
interval_seconds = number
transport = string
port = number
path = optional(string, null)
})), [])
env = optional(list(object({
name = string
value = optional(string, null)
secretRef = optional(string, null)
})), [])
min_replicas = number
max_replicas = number
}))
map(| `{}` | no | | [dns\_ns\_records](#input\_dns\_ns\_records) | DNS NS records to add to the DNS Zone |
object({
ttl : optional(number, 300),
records : list(
object({
preference : number,
exchange : string
})
)
})
)
map(| n/a | yes | | [dns\_txt\_records](#input\_dns\_txt\_records) | DNS TXT records to add to the DNS Zone |
object({
ttl : optional(number, 300),
records : list(string)
})
)
map(| n/a | yes | diff --git a/terraform/container-apps-hosting.tf b/terraform/container-apps-hosting.tf index a61a85d59..4e032f861 100644 --- a/terraform/container-apps-hosting.tf +++ b/terraform/container-apps-hosting.tf @@ -51,4 +51,6 @@ module "azure_container_apps_hosting" { existing_logic_app_workflow = local.existing_logic_app_workflow existing_network_watcher_name = local.existing_network_watcher_name existing_network_watcher_resource_group_name = local.existing_network_watcher_resource_group_name + + custom_container_apps = local.custom_container_apps } diff --git a/terraform/locals.tf b/terraform/locals.tf index 1002f0146..7169e04dd 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -47,4 +47,5 @@ locals { statuscake_contact_group_name = var.statuscake_contact_group_name statuscake_contact_group_integrations = var.statuscake_contact_group_integrations statuscake_contact_group_email_addresses = var.statuscake_contact_group_email_addresses + custom_container_apps = var.custom_container_apps } diff --git a/terraform/variables.tf b/terraform/variables.tf index b45226591..6c9c1df42 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -324,3 +324,61 @@ variable "cdn_frontdoor_waf_custom_rules" { })) default = {} } + +variable "custom_container_apps" { + description = "Custom container apps, by default deployed within the container app environment managed by this module." + type = map(object({ + container_app_environment_id = optional(string, "") + resource_group_name = optional(string, "") + revision_mode = optional(string, "Single") + container_port = optional(number, 0) + ingress = optional(object({ + external_enabled = optional(bool, true) + target_port = optional(number, null) + traffic_weight = object({ + percentage = optional(number, 100) + }) + cdn_frontdoor_custom_domain = optional(string, "") + cdn_frontdoor_origin_fqdn_override = optional(string, "") + cdn_frontdoor_origin_host_header_override = optional(string, "") + enable_cdn_frontdoor_health_probe = optional(bool, false) + cdn_frontdoor_health_probe_protocol = optional(string, "") + cdn_frontdoor_health_probe_interval = optional(number, 120) + cdn_frontdoor_health_probe_request_type = optional(string, "") + cdn_frontdoor_health_probe_path = optional(string, "") + cdn_frontdoor_forwarding_protocol_override = optional(string, "") + }), null) + identity = optional(list(object({ + type = string + identity_ids = list(string) + })), []) + secrets = optional(list(object({ + name = string + value = string + })), []) + registry = optional(object({ + server = optional(string, "") + username = optional(string, "") + password_secret_name = optional(string, "") + identity = optional(string, "") + }), null), + image = string + cpu = number + memory = number + command = list(string) + liveness_probes = optional(list(object({ + interval_seconds = number + transport = string + port = number + path = optional(string, null) + })), []) + env = optional(list(object({ + name = string + value = optional(string, null) + secretRef = optional(string, null) + })), []) + min_replicas = number + max_replicas = number + })) + default = {} +}
object({
ttl : optional(number, 300),
records : list(string)
})
)