From ff0f35bcf04a3da027e2355f306b4493f91afe8c Mon Sep 17 00:00:00 2001 From: "maicon.rocha@dnx.solutions" Date: Fri, 4 Jun 2021 07:43:17 +0000 Subject: [PATCH] adding variable for specify number of aurora instances on the cluster --- _variables.tf | 6 ++++++ aurora.tf | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/_variables.tf b/_variables.tf index 2bca6d0..2d0ceff 100644 --- a/_variables.tf +++ b/_variables.tf @@ -132,3 +132,9 @@ variable "preferred_backup_window" { type = string default = "07:00-09:00" } + +variable "count_aurora_instances" { + description = "Number of Aurora Instances" + type = number + default = "1" +} diff --git a/aurora.tf b/aurora.tf index 6f8630f..651fe66 100644 --- a/aurora.tf +++ b/aurora.tf @@ -15,7 +15,7 @@ resource "aws_rds_cluster" "aurora_cluster" { } resource "aws_rds_cluster_instance" "cluster_instances" { - count = var.db_type == "aurora" ? 2 : 0 + count = var.db_type == "aurora" ? var.count_aurora_instances : 0 identifier = "${var.identifier}-${count.index}" cluster_identifier = aws_rds_cluster.aurora_cluster[0].id instance_class = var.instance_class