Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(main.tf): handle enabled boolean in manage_rules #124

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/cis/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
output "enabled_rules" {
value = module.cis_rules.rules
value = module.cis_rules.rules
description = "The output of the enabled CIS rules"
}

output "config_recorder_id" {
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ resource "aws_config_configuration_recorder_status" "recorder_status" {
}

resource "aws_config_config_rule" "rules" {
for_each = module.this.enabled ? var.managed_rules : {}
for_each = module.this.enabled ? { for k, v in var.managed_rules : k => v if v.enabled } : {}
depends_on = [aws_config_configuration_recorder_status.recorder_status]

name = each.key
Expand Down
3 changes: 2 additions & 1 deletion modules/cis-1-2-rules/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "rules" {
value = local.enabled_rules
value = local.enabled_rules
description = "Enabled rules"
}
15 changes: 15 additions & 0 deletions modules/cis-1-2-rules/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
}

http = {
source = "hashicorp/http"
version = ">= 3.4.1"
}
}
}
3 changes: 2 additions & 1 deletion modules/conformance-pack/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "arn" {
value = aws_config_conformance_pack.default.arn
value = aws_config_conformance_pack.default.arn
description = "ARN of the conformance pack"
}
Loading