From 4a8a28e185ea1aa76ef1315c2c24e47c4fb2a311 Mon Sep 17 00:00:00 2001 From: kvvasudev Date: Fri, 16 Feb 2024 11:48:11 +0000 Subject: [PATCH] RWA-2932: Remove Postgres single server infra. (#683) Co-authored-by: vasu --- infrastructure/main.tf | 52 ++++-------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/infrastructure/main.tf b/infrastructure/main.tf index e44aee492..f5849b617 100644 --- a/infrastructure/main.tf +++ b/infrastructure/main.tf @@ -1,5 +1,9 @@ provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } provider "azurerm" { @@ -60,19 +64,6 @@ locals { common_tags = merge(var.common_tags, local.computed_tags) } -module "wa_case_event_handler_database" { - source = "git@github.com:hmcts/cnp-module-postgres?ref=master" - product = "${var.product}" - name = "${var.postgres_db_component_name}-postgres-db" - location = "${var.location}" - env = "${var.env}" - database_name = "${var.postgresql_database_name}" - postgresql_user = "${var.postgresql_user}" - postgresql_version = "11" - common_tags = "${local.common_tags}" - subscription = "${var.subscription}" -} - //Azure Flexible Server DB module "wa_case_event_handler_database_flex" { providers = { @@ -110,39 +101,6 @@ module "wa_case_event_handler_database_flex" { } - -// Save secrets in vault -resource "azurerm_key_vault_secret" "POSTGRES-USER" { - name = "${var.postgres_db_component_name}-POSTGRES-USER" - value = module.wa_case_event_handler_database.user_name - key_vault_id = data.azurerm_key_vault.wa_key_vault.id -} - -resource "azurerm_key_vault_secret" "POSTGRES-PASS" { - name = "${var.postgres_db_component_name}-POSTGRES-PASS" - value = module.wa_case_event_handler_database.postgresql_password - key_vault_id = data.azurerm_key_vault.wa_key_vault.id -} - -resource "azurerm_key_vault_secret" "POSTGRES_HOST" { - name = "${var.postgres_db_component_name}-POSTGRES-HOST" - value = module.wa_case_event_handler_database.host_name - key_vault_id = data.azurerm_key_vault.wa_key_vault.id -} - -resource "azurerm_key_vault_secret" "POSTGRES_PORT" { - name = "${var.postgres_db_component_name}-POSTGRES-PORT" - value = module.wa_case_event_handler_database.postgresql_listen_port - key_vault_id = data.azurerm_key_vault.wa_key_vault.id -} - -resource "azurerm_key_vault_secret" "POSTGRES_DATABASE" { - name = "${var.postgres_db_component_name}-POSTGRES-DATABASE" - value = module.wa_case_event_handler_database.postgresql_database - key_vault_id = data.azurerm_key_vault.wa_key_vault.id -} - - // Secrets for Postgres Flex Server DB resource "azurerm_key_vault_secret" "POSTGRES-USER-V15" { name = "${var.postgres_db_component_name}-POSTGRES-USER-V15"