-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip]: Deploy rewritten highscore api as container app
- Loading branch information
Christian Fosli
committed
Jul 3, 2023
1 parent
5c3ef3a
commit 874d8b2
Showing
2 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
# TODO: Deploy new highscore API as az container app | ||
resource "azurerm_container_app_environment" "containerAppEnv" { | ||
name = "cae-snake-${var.ENVIRONMENT}" | ||
location = data.azurerm_resource_group.rg.location | ||
resource_group_name = data.azurerm_resource_group.rg.name | ||
log_analytics_workspace_id = azurerm_log_analytics_workspace.logWorkspace.id | ||
} | ||
|
||
resource "azurerm_container_app" "highscoreApi" { | ||
name = "ca-snakehighscoreapi-${var.ENVIRONMENT}" | ||
container_app_environment_id = azurerm_container_app_environment.containerAppEnv.id | ||
resource_group_name = azurerm_container_app_environment.containerAppEnv.resource_group_name | ||
revision_mode = "Single" | ||
|
||
template { | ||
container { | ||
name = "highscore-api" | ||
image = "ghcr.io/christianfosli/snake/highscore-api:latest" # <-- tag will be overridden by ci/cd | ||
cpu = 0.25 | ||
memory = "0.5Gi" | ||
|
||
env { | ||
name = "DB_CONNSTR" | ||
secret_name = "db-connstr" | ||
} | ||
|
||
liveness_probe { | ||
transport = "HTTP" | ||
path = "/livez" | ||
port = 3000 | ||
} | ||
|
||
readiness_probe { | ||
transport = "HTTP" | ||
path = "/readyz" | ||
port = 3000 | ||
} | ||
} | ||
} | ||
|
||
ingress { | ||
# custom_domain { | ||
# # Manual Step: Currently (July 2023), azurerm_container_app_environment_certificate doesn't support | ||
# # managed TLS certificates. | ||
# # Therefore during initial deploy this block must be commented out, and added through the Azure Portal | ||
# # Then the below certificate_id must be updated as required. | ||
# name = "${azurerm_dns_cname_record.highScoreApi.name}.${azurerm_dns_cname_record.highScoreApi.zone_name}" | ||
# certificate_id = "??" | ||
# certificate_binding_type = "SniEnabled" | ||
# } | ||
target_port = 3000 | ||
|
||
traffic_weight { | ||
percentage = 100 | ||
} | ||
} | ||
|
||
secret { | ||
name = "db-connstr" | ||
value = azurerm_key_vault_secret.mongoConnectionString.value | ||
} | ||
|
||
|
||
tags = local.common_tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters