From 3b2d60eec9583707dad17f6aee8c56d3c10ce122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahlstr=C3=B6m=20Kalle?= Date: Thu, 18 Jan 2024 13:08:38 +0200 Subject: [PATCH] move to an atlas deployed mongo instance for now --- main.tf | 2 +- modules/common/main.tf | 2 +- modules/keyvault/main.tf | 5 +++++ modules/keyvault/output.tf | 5 +++++ modules/web/app/main.tf | 5 ++++- modules/web/storage/main.tf | 35 ----------------------------------- modules/web/storage/output.tf | 6 ------ 7 files changed, 16 insertions(+), 44 deletions(-) diff --git a/main.tf b/main.tf index 8bc496f..ffb9d4f 100644 --- a/main.tf +++ b/main.tf @@ -127,7 +127,7 @@ module "web" { root_zone_name = module.dns_prod.root_zone_name dns_resource_group_name = module.dns_prod.resource_group_name subdomain = "alpha" - mongo_connection_string = module.web_storage.mongo_connection_string + mongo_connection_string = module.keyvault.mongo_db_connection_string google_oauth_client_id = module.keyvault.google_oauth_client_id google_oauth_client_secret = module.keyvault.google_oauth_client_secret storage_connection_string = module.web_storage.storage_connection_string diff --git a/modules/common/main.tf b/modules/common/main.tf index 71bff6b..67866b9 100644 --- a/modules/common/main.tf +++ b/modules/common/main.tf @@ -48,7 +48,7 @@ resource "azurerm_service_plan" "tikweb_plan" { resource_group_name = azurerm_resource_group.tikweb_rg.name os_type = "Linux" - sku_name = "B3" + sku_name = "P0v3" } resource "tls_private_key" "acme_account_key" { diff --git a/modules/keyvault/main.tf b/modules/keyvault/main.tf index 339d937..204ab0b 100644 --- a/modules/keyvault/main.tf +++ b/modules/keyvault/main.tf @@ -120,3 +120,8 @@ data "azurerm_key_vault_secret" "google_oauth_client_secret" { key_vault_id = azurerm_key_vault.keyvault.id depends_on = [azurerm_key_vault_access_policy.admin, azurerm_key_vault_access_policy.CI] } +data "azurerm_key_vault_secret" "mongo_db_connection_string" { + name = "mongo-db-connection-string" + key_vault_id = azurerm_key_vault.keyvault.id + depends_on = [azurerm_key_vault_access_policy.admin, azurerm_key_vault_access_policy.CI] +} diff --git a/modules/keyvault/output.tf b/modules/keyvault/output.tf index 6fb5afa..3f9cbc3 100644 --- a/modules/keyvault/output.tf +++ b/modules/keyvault/output.tf @@ -47,3 +47,8 @@ output "google_oauth_client_secret" { value = data.azurerm_key_vault_secret.google_oauth_client_secret.value sensitive = true } + +output "mongo_db_connection_string" { + value = data.azurerm_key_vault_secret.mongo_db_connection_string.value + sensitive = true +} diff --git a/modules/web/app/main.tf b/modules/web/app/main.tf index 92c022a..2c80a8b 100644 --- a/modules/web/app/main.tf +++ b/modules/web/app/main.tf @@ -13,7 +13,7 @@ resource "azurerm_linux_web_app" "frontend" { site_config { application_stack { docker_registry_url = "https://ghcr.io" - docker_image_name = "tietokilta/web:latest" + docker_image_name = "tietokilta/web:sha-a11d358" } } logs { @@ -23,6 +23,9 @@ resource "azurerm_linux_web_app" "frontend" { retention_in_mb = 100 } } + application_logs { + file_system_level = "Verbose" + } } https_only = true app_settings = { diff --git a/modules/web/storage/main.tf b/modules/web/storage/main.tf index f694fe8..e662687 100644 --- a/modules/web/storage/main.tf +++ b/modules/web/storage/main.tf @@ -1,38 +1,3 @@ -resource "azurerm_cosmosdb_account" "db_account" { - name = "tikweb-cosmosdb-${terraform.workspace}" - location = var.resource_group_location - resource_group_name = var.resource_group_name - offer_type = "Standard" - kind = "MongoDB" - mongo_server_version = "4.2" - enable_free_tier = true - capabilities { - name = "EnableMongo" - } - capabilities { - name = "EnableServerless" - } - capabilities { - name = "EnableMongoRetryableWrites" - } - consistency_policy { - consistency_level = "Session" - } - - geo_location { - location = var.resource_group_location - failover_priority = 0 - } - capacity { - total_throughput_limit = 3000 - } - backup { - retention_in_hours = 168 - interval_in_minutes = 1440 - type = "Periodic" - } -} - resource "azurerm_storage_account" "tikweb_storage_account" { name = "tikwebstorage${terraform.workspace}" resource_group_name = var.resource_group_name diff --git a/modules/web/storage/output.tf b/modules/web/storage/output.tf index 323571f..62fed15 100644 --- a/modules/web/storage/output.tf +++ b/modules/web/storage/output.tf @@ -1,9 +1,3 @@ -// Mongo -output "mongo_connection_string" { - value = azurerm_cosmosdb_account.db_account.primary_mongodb_connection_string - sensitive = true -} - // Storage output "storage_account_name" {