Skip to content

Commit be8eeab

Browse files
committed
Restored some of the logic of enable_create_redshift_* locals
1 parent 3f9e923 commit be8eeab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
locals {
22
redshift_subnet_group_name = "${coalesce(var.redshift_subnet_group_name, element(concat(aws_redshift_subnet_group.this.*.name, list("")), 0))}"
3+
enable_create_redshift_subnet_group = "${var.redshift_subnet_group_name == "" ? 1 : 0}"
34
parameter_group_name = "${coalesce(var.parameter_group_name, element(concat(aws_redshift_parameter_group.this.*.id, list("")), 0))}"
5+
enable_create_redshift_parameter_group = "${var.parameter_group_name == "" ? 0 : 1}"
46
}
57

68
resource "aws_redshift_cluster" "this" {
@@ -54,7 +56,7 @@ resource "aws_redshift_cluster" "this" {
5456
}
5557

5658
resource "aws_redshift_parameter_group" "this" {
57-
count = "${var.parameter_group_name != "" ? 1 : 0}"
59+
count = "${local.enable_create_redshift_parameter_group}"
5860

5961
name = "${var.cluster_identifier}-${replace(var.cluster_parameter_group, ".", "-")}-custom-params"
6062
family = "${var.cluster_parameter_group}"
@@ -66,7 +68,7 @@ resource "aws_redshift_parameter_group" "this" {
6668
}
6769

6870
resource "aws_redshift_subnet_group" "this" {
69-
count = "${var.redshift_subnet_group_name != "" ? 0 : 1}"
71+
count = "${local.enable_create_redshift_subnet_group}"
7072

7173
name = "${var.cluster_identifier}"
7274
description = "Redshift subnet group of ${var.cluster_identifier}"

0 commit comments

Comments
 (0)