From 21dfaa376de90308dae5dbc5a284038568357c31 Mon Sep 17 00:00:00 2001 From: Maharshi Bhatnagar <159241848+NotMaharshi@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:32:56 +0530 Subject: [PATCH] feat: Added support for server custom name (#50) Co-authored-by: Vishal Sharma --- main.tf | 2 +- variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 93d01ca..10090d7 100644 --- a/main.tf +++ b/main.tf @@ -47,7 +47,7 @@ module "labels" { ##----------------------------------------------------------------------------- resource "azurerm_postgresql_flexible_server" "main" { count = var.enabled ? 1 : 0 - name = format("%s-pgsql-flexible-server", module.labels.id) + name = var.server_custom_name != null ? var.server_custom_name : format("%s-pgsql-flexible-server", module.labels.id) resource_group_name = local.resource_group_name location = local.location administrator_login = var.admin_username diff --git a/variables.tf b/variables.tf index dcf1138..1963e31 100644 --- a/variables.tf +++ b/variables.tf @@ -6,6 +6,12 @@ variable "name" { description = "Name (e.g. `app` or `cluster`)." } +variable "server_custom_name" { + description = "User defined name for the PostgreSQL flexible server" + type = string + default = null +} + variable "environment" { type = string default = ""