From cbd600f873b1fd6cbf6ee2b5806c1fc9d0988823 Mon Sep 17 00:00:00 2001 From: Steven Whitaker Date: Mon, 25 Mar 2019 10:18:47 +0000 Subject: [PATCH] Fixes a couple of issues realted to a data resource and an output --- main.tf | 8 ++++---- outputs.tf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 06571a1..2e90d3f 100644 --- a/main.tf +++ b/main.tf @@ -277,20 +277,20 @@ data "aws_iam_policy_document" "monitoring-rds-assume-role-policy" { } resource "aws_iam_role" "rds-enhanced-monitoring" { - count = "${var.monitoring_interval > 0 ? 1 : 0}" + count = "${var.enabled && var.monitoring_interval > 0 ? 1 : 0}" name_prefix = "rds-enhanced-mon-${var.envname}-" assume_role_policy = "${data.aws_iam_policy_document.monitoring-rds-assume-role-policy.json}" } resource "aws_iam_role_policy_attachment" "rds-enhanced-monitoring-policy-attach" { - count = "${var.monitoring_interval > 0 ? 1 : 0}" + count = "${var.enabled && var.monitoring_interval > 0 ? 1 : 0}" role = "${aws_iam_role.rds-enhanced-monitoring.name}" policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" } // Autoscaling resource "aws_appautoscaling_target" "autoscaling" { - count = "${var.replica_scale_enabled ? 1 : 0}" + count = "${var.enabled && var.replica_scale_enabled ? 1 : 0}" max_capacity = "${var.replica_scale_max}" min_capacity = "${var.replica_scale_min}" resource_id = "cluster:${aws_rds_cluster.default.cluster_identifier}" @@ -299,7 +299,7 @@ resource "aws_appautoscaling_target" "autoscaling" { } resource "aws_appautoscaling_policy" "autoscaling" { - count = "${var.replica_scale_enabled ? 1 : 0}" + count = "${var.enabled && var.replica_scale_enabled ? 1 : 0}" depends_on = ["aws_appautoscaling_target.autoscaling"] name = "target-metric" policy_type = "TargetTrackingScaling" diff --git a/outputs.tf b/outputs.tf index 1a128b7..36ecffb 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,7 +5,7 @@ output "cluster_endpoint" { // Comma separated list of all DB instance endpoints running in cluster output "all_instance_endpoints_list" { - value = ["${aws_rds_cluster_instance.cluster_instance_0.endpoint}", "${aws_rds_cluster_instance.cluster_instance_n.*.endpoint}"] + value = ["${concat(aws_rds_cluster_instance.cluster_instance_0.*.endpoint, aws_rds_cluster_instance.cluster_instance_n.*.endpoint)}"] } // A read-only endpoint for the Aurora cluster, automatically load-balanced across replicas