Skip to content

Commit 1fdaffd

Browse files
authored
Merge pull request #30 from swhitaker90/stevew/fixes_enabled_flag
Fixes a couple of issues related to enabled flag
2 parents 23f19b5 + cbd600f commit 1fdaffd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,20 @@ data "aws_iam_policy_document" "monitoring-rds-assume-role-policy" {
277277
}
278278

279279
resource "aws_iam_role" "rds-enhanced-monitoring" {
280-
count = "${var.monitoring_interval > 0 ? 1 : 0}"
280+
count = "${var.enabled && var.monitoring_interval > 0 ? 1 : 0}"
281281
name_prefix = "rds-enhanced-mon-${var.envname}-"
282282
assume_role_policy = "${data.aws_iam_policy_document.monitoring-rds-assume-role-policy.json}"
283283
}
284284

285285
resource "aws_iam_role_policy_attachment" "rds-enhanced-monitoring-policy-attach" {
286-
count = "${var.monitoring_interval > 0 ? 1 : 0}"
286+
count = "${var.enabled && var.monitoring_interval > 0 ? 1 : 0}"
287287
role = "${aws_iam_role.rds-enhanced-monitoring.name}"
288288
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
289289
}
290290

291291
// Autoscaling
292292
resource "aws_appautoscaling_target" "autoscaling" {
293-
count = "${var.replica_scale_enabled ? 1 : 0}"
293+
count = "${var.enabled && var.replica_scale_enabled ? 1 : 0}"
294294
max_capacity = "${var.replica_scale_max}"
295295
min_capacity = "${var.replica_scale_min}"
296296
resource_id = "cluster:${aws_rds_cluster.default.cluster_identifier}"
@@ -299,7 +299,7 @@ resource "aws_appautoscaling_target" "autoscaling" {
299299
}
300300

301301
resource "aws_appautoscaling_policy" "autoscaling" {
302-
count = "${var.replica_scale_enabled ? 1 : 0}"
302+
count = "${var.enabled && var.replica_scale_enabled ? 1 : 0}"
303303
depends_on = ["aws_appautoscaling_target.autoscaling"]
304304
name = "target-metric"
305305
policy_type = "TargetTrackingScaling"

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ output "cluster_endpoint" {
55

66
// Comma separated list of all DB instance endpoints running in cluster
77
output "all_instance_endpoints_list" {
8-
value = ["${aws_rds_cluster_instance.cluster_instance_0.endpoint}", "${aws_rds_cluster_instance.cluster_instance_n.*.endpoint}"]
8+
value = ["${concat(aws_rds_cluster_instance.cluster_instance_0.*.endpoint, aws_rds_cluster_instance.cluster_instance_n.*.endpoint)}"]
99
}
1010

1111
// A read-only endpoint for the Aurora cluster, automatically load-balanced across replicas

0 commit comments

Comments
 (0)