diff --git a/infra/terraform/cosmosdb.tf b/infra/terraform/cosmosdb.tf index b642e01b..bb292d98 100644 --- a/infra/terraform/cosmosdb.tf +++ b/infra/terraform/cosmosdb.tf @@ -5,7 +5,7 @@ resource "azurerm_cosmosdb_account" "db_account" { offer_type = "Standard" kind = "MongoDB" - enable_automatic_failover = true + automatic_failover_enabled = true capabilities { # forces replacement name = "EnableMongo" diff --git a/infra/terraform/log-analytics.tf b/infra/terraform/log-analytics.tf new file mode 100644 index 00000000..5ae5ca27 --- /dev/null +++ b/infra/terraform/log-analytics.tf @@ -0,0 +1,22 @@ +resource "azurerm_log_analytics_workspace" "gratibot" { + name = "gratibot-${var.environment}" + location = var.location + resource_group_name = var.resource_group_name + sku = "PerGB2018" + retention_in_days = 30 + daily_quota_gb = 0.5 +} + +resource "azurerm_monitor_diagnostic_setting" "gratibot-logs" { + name = "gratibot-logs" + target_resource_id = azurerm_linux_web_app.gratibot_app_service.id + log_analytics_workspace_id = azurerm_log_analytics_workspace.gratibot.id + + enabled_log { + category = "AppServiceConsoleLogs" + } + metric { + category = "AllMetrics" + enabled = false + } +} diff --git a/infra/terraform/vault.tf b/infra/terraform/vault.tf index 4cc3264c..a468bf08 100644 --- a/infra/terraform/vault.tf +++ b/infra/terraform/vault.tf @@ -11,7 +11,7 @@ resource "azurerm_role_assignment" "gratibot" { resource "azurerm_key_vault_secret" "mongo_connection_string" { name = "mongo-connection-string" - value = azurerm_cosmosdb_account.db_account.connection_strings[0] + value = azurerm_cosmosdb_account.db_account.primary_mongodb_connection_string key_vault_id = data.azurerm_key_vault.gratibot.id }