Skip to content

Commit

Permalink
RWA-2932: Remove Postgres single server infra. (#683)
Browse files Browse the repository at this point in the history
Co-authored-by: vasu <[email protected]>
  • Loading branch information
kvvasudev and vasu authored Feb 16, 2024
1 parent 7dadfe8 commit 4a8a28e
Showing 1 changed file with 5 additions and 47 deletions.
52 changes: 5 additions & 47 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
provider "azurerm" {
features {}
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

provider "azurerm" {
Expand Down Expand Up @@ -60,19 +64,6 @@ locals {
common_tags = merge(var.common_tags, local.computed_tags)
}

module "wa_case_event_handler_database" {
source = "[email protected]: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 = {
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 4a8a28e

Please sign in to comment.