Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed May 24, 2021
1 parent 06c9bbf commit f61fe09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/config_rules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ locals {
"ENCRYPTED_VOLUMES",
"RDS_STORAGE_ENCRYPTED",
]
crule_list = var.enable_config_rules_standard ? local.crules : []
}

resource "aws_config_config_rule" "config_rules" {
for_each = var.enable_config_rules_standard ? toset(local.crules) : {}
for_each = toset(local.crules)
name = format("inf-config-rule_%v", each.key)
source {
owner = "AWS"
Expand All @@ -36,16 +37,15 @@ locals {
parameter = jsonencode({ AllowedDays = "30" })
}
]

crule_list = var.enable_config_rules_standard ? local.crules : []
crule_stopped_list = var.enable_config_rules_stopped ? [for cr in local.crules_stopped : cr.rule] : []
crule_stopped_map = var.enable_config_rules_stopped ? { for cr in local.crules_stopped : cr.name => cr } : {}

all_crules = concat(local.crule_list, local.crule_stopped_list)
all_crules_names = { for c in local.all_crules : c => format("inf-config-rule_%v", c) }
}

resource "aws_config_config_rule" "config_rules_stopped" {
for_each = var.enable_config_rules_stopped ? { for cr in local.crules_stopped : cr.name => cr } : {}
for_each = local.crule_stopped_map
name = format("inf-config-rule_%v", each.key)
source {
owner = "AWS"
Expand Down

0 comments on commit f61fe09

Please sign in to comment.