From 9f204efc0c9c236912a94ee405afb9545ad0511d Mon Sep 17 00:00:00 2001 From: Hamza Baig Date: Fri, 12 Jul 2024 13:16:16 -0700 Subject: [PATCH 1/3] flag to stop azure postgres errors --- modules/database/main.tf | 3 ++- modules/database/variables.tf | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/database/main.tf b/modules/database/main.tf index f3439f5e..2f98d2da 100644 --- a/modules/database/main.tf +++ b/modules/database/main.tf @@ -11,7 +11,8 @@ resource "azurerm_postgresql_flexible_server" "tfe" { location = var.location name = "${var.friendly_name_prefix}-pg" resource_group_name = var.resource_group_name - + public_network_access_enabled = var.public_network_access_enabled + administrator_login = var.database_user administrator_login = var.database_user administrator_password = random_string.tfe_pg_password.result backup_retention_days = var.database_backup_retention_days diff --git a/modules/database/variables.tf b/modules/database/variables.tf index 141113a8..c5d95467 100644 --- a/modules/database/variables.tf +++ b/modules/database/variables.tf @@ -42,6 +42,12 @@ variable "database_size_mb" { description = "Postgres storage size in MB" } +variable "public_network_access_enabled" { + default = "false" + type = string + description = "Public network access with virtual network interface" +} + variable "database_version" { type = string description = "Postgres version" From 196b0875f5d14e9ba01824b7d4cc35e26fd9c8c9 Mon Sep 17 00:00:00 2001 From: Hamza Baig Date: Fri, 12 Jul 2024 13:24:54 -0700 Subject: [PATCH 2/3] removing dup administrator_password --- modules/database/main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/database/main.tf b/modules/database/main.tf index 2f98d2da..62e336c3 100644 --- a/modules/database/main.tf +++ b/modules/database/main.tf @@ -13,7 +13,6 @@ resource "azurerm_postgresql_flexible_server" "tfe" { resource_group_name = var.resource_group_name public_network_access_enabled = var.public_network_access_enabled administrator_login = var.database_user - administrator_login = var.database_user administrator_password = random_string.tfe_pg_password.result backup_retention_days = var.database_backup_retention_days delegated_subnet_id = var.database_subnet_id From f6f0e71124d9ed650a2244e9b6a3cf4e6830e8f6 Mon Sep 17 00:00:00 2001 From: sandrampeter Date: Fri, 19 Jul 2024 12:36:34 -0400 Subject: [PATCH 3/3] fmt fix --- modules/database/main.tf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/database/main.tf b/modules/database/main.tf index 62e336c3..19621068 100644 --- a/modules/database/main.tf +++ b/modules/database/main.tf @@ -8,20 +8,20 @@ resource "random_string" "tfe_pg_password" { } resource "azurerm_postgresql_flexible_server" "tfe" { - location = var.location - name = "${var.friendly_name_prefix}-pg" - resource_group_name = var.resource_group_name + location = var.location + name = "${var.friendly_name_prefix}-pg" + resource_group_name = var.resource_group_name public_network_access_enabled = var.public_network_access_enabled - administrator_login = var.database_user - administrator_password = random_string.tfe_pg_password.result - backup_retention_days = var.database_backup_retention_days - delegated_subnet_id = var.database_subnet_id - private_dns_zone_id = var.database_private_dns_zone_id - sku_name = var.database_machine_type - storage_mb = var.database_size_mb - tags = var.tags - version = var.database_version - zone = var.database_availability_zone + administrator_login = var.database_user + administrator_password = random_string.tfe_pg_password.result + backup_retention_days = var.database_backup_retention_days + delegated_subnet_id = var.database_subnet_id + private_dns_zone_id = var.database_private_dns_zone_id + sku_name = var.database_machine_type + storage_mb = var.database_size_mb + tags = var.tags + version = var.database_version + zone = var.database_availability_zone } resource "azurerm_postgresql_flexible_server_configuration" "tfe" {