From b4e99804bcd69b28516f65af0c91a887cd580c0f Mon Sep 17 00:00:00 2001 From: Nikolas Rieble Date: Mon, 15 Jul 2024 14:48:11 +0200 Subject: [PATCH] Feature: Introduce variables database_host and database_password --- locals.tf | 10 +++++----- variables.tf | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/locals.tf b/locals.tf index 07a31f24..7767bd8f 100644 --- a/locals.tf +++ b/locals.tf @@ -5,7 +5,7 @@ locals { disk_device_name = "sdb" enable_airgap = var.airgap_url == null && var.tfe_license_bootstrap_airgap_package_path != null enable_external = var.operational_mode == "external" || var.operational_mode == "active-active" - enable_database_module = local.enable_external + enable_database_module = local.enable_external && var.database_host == null enable_disk = var.operational_mode == "disk" enable_networking_module = var.network == null enable_object_storage_module = local.enable_external @@ -88,10 +88,10 @@ locals { database = try( module.database[0], { - dbname = null - netloc = null - password = null - user = null + dbname = var.database_name + netloc = var.database_host + password = var.database_password + user = var.database_user } ) } diff --git a/variables.tf b/variables.tf index f957c9d7..e8f77534 100644 --- a/variables.tf +++ b/variables.tf @@ -151,6 +151,18 @@ variable "subnetwork" { # DATABASE # -------- +variable "database_host" { + default = null + description = "Database host" + type = string +} + +variable "database_password" { + default = null + description = "Only needed if we provide a database host." + type = string +} + variable "database_availability_type" { default = "ZONAL" description = "Database Availability Type"