diff --git a/ops/terraform/main.tf b/ops/terraform/main.tf index 89f159e5..95d9ca1c 100644 --- a/ops/terraform/main.tf +++ b/ops/terraform/main.tf @@ -86,6 +86,7 @@ module "ocr_autoscale" { module "database" { source = "./modules/database" + env = local.environment resource_group_name = data.azurerm_resource_group.rg.name subnet = module.networking.dbsubnet_id private_dns_zone_id = module.networking.private_dns_zone_id diff --git a/ops/terraform/modules/database/main.tf b/ops/terraform/modules/database/main.tf index 4bb30a53..4954d77f 100644 --- a/ops/terraform/modules/database/main.tf +++ b/ops/terraform/modules/database/main.tf @@ -2,7 +2,7 @@ # As a result we are using Azure Database for PostgreSQL Flexible Server # with granular control, flexibility and better cost optimization. resource "azurerm_postgresql_flexible_server" "postgres_flexible_server" { - name = "reportvisionpostgresql-flexible-server" + name = "reportvisionpostgresql-flexible-server-${var.env}" location = var.location resource_group_name = var.resource_group_name sku_name = var.postgres_sku_name diff --git a/ops/terraform/modules/database/variables.tf b/ops/terraform/modules/database/variables.tf index ef91bef5..0c36065e 100644 --- a/ops/terraform/modules/database/variables.tf +++ b/ops/terraform/modules/database/variables.tf @@ -35,3 +35,8 @@ variable "private_dns_zone_id" { type = string description = "Private DNS Zone for PostgreSQL Flexible Server" } + +variable "env" { + type = string + description = "Environment variable for the environment being provisioned" +}