Skip to content

Commit

Permalink
move to an atlas deployed mongo instance for now
Browse files Browse the repository at this point in the history
  • Loading branch information
kahlstrm committed Jan 18, 2024
1 parent e7e1a04 commit 3b2d60e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 44 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/common/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
5 changes: 5 additions & 0 deletions modules/keyvault/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
5 changes: 5 additions & 0 deletions modules/keyvault/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 4 additions & 1 deletion modules/web/app/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 = {
Expand Down
35 changes: 0 additions & 35 deletions modules/web/storage/main.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 0 additions & 6 deletions modules/web/storage/output.tf
Original file line number Diff line number Diff line change
@@ -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" {
Expand Down

0 comments on commit 3b2d60e

Please sign in to comment.