From 77f8ae126275ea02f8ea58d08a6e996aa01445e7 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Tue, 23 May 2023 11:22:30 +0800 Subject: [PATCH] use null instead of empty string Try to resolve errors: '"username": conflicts with replicate_source_db' and 'expected replica_mode to be one of [open-read-only mounted]' --- aws/rds/mariadb/main.tf | 6 +++--- aws/rds/mariadb/vars.tf | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aws/rds/mariadb/main.tf b/aws/rds/mariadb/main.tf index 1b9d51e..152ee15 100644 --- a/aws/rds/mariadb/main.tf +++ b/aws/rds/mariadb/main.tf @@ -4,10 +4,10 @@ resource "aws_db_instance" "db_instance" { allocated_storage = var.allocated_storage copy_tags_to_snapshot = var.copy_tags_to_snapshot instance_class = var.instance_class - db_name = var.replicate_source_db == "" ? var.db_name : "" + db_name = var.replicate_source_db == null ? var.db_name : null identifier = "${var.app_name}-${var.app_env}" - username = var.replicate_source_db == "" ? var.db_root_user : "" - password = var.replicate_source_db == "" ? var.db_root_pass : "" + username = var.replicate_source_db == null ? var.db_root_user : null + password = var.replicate_source_db == null ? var.db_root_pass : null db_subnet_group_name = var.subnet_group_name storage_type = var.storage_type storage_encrypted = var.storage_encrypted diff --git a/aws/rds/mariadb/vars.tf b/aws/rds/mariadb/vars.tf index 5f53a9e..ea92e4a 100644 --- a/aws/rds/mariadb/vars.tf +++ b/aws/rds/mariadb/vars.tf @@ -117,11 +117,11 @@ variable "tags" { variable "replicate_source_db" { type = string description = "To create a replica DB, specify the source database" - default = "" + default = null } variable "replica_mode" { type = string description = "Specifies whether the replica is in either \"mounted\" or \"open-read-only\" mode. This attribute is only supported by Oracle instances." - default = "" + default = null }