Skip to content

Commit f147ec8

Browse files
committed
fix(macie-account): support single account
1 parent f2efd71 commit f147ec8

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

modules/macie-account/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This module creates following resources.
44

55
- `aws_macie2_account`
6-
- `aws_macie2_organization_configuration`
6+
- `aws_macie2_organization_configuration` (optional)
77
- `aws_macie2_member` (optional)
88
- `aws_macie2_classification_export_configuration` (optional)
99

modules/macie-account/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ resource "aws_macie2_member" "this" {
8989
###################################################
9090

9191
resource "aws_macie2_organization_configuration" "this" {
92+
count = anytrue([
93+
for account in var.member_accounts :
94+
account.type == "ORGANIZATION"
95+
]) ? 1 : 0
96+
9297
region = aws_macie2_account.this.region
9398

9499
auto_enable = var.organization_config.auto_enable

modules/macie-account/outputs.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ output "organization_config" {
6565
description = <<EOF
6666
The organization configuration for the macie account.
6767
EOF
68-
value = {
69-
auto_enable = aws_macie2_organization_configuration.this.auto_enable
70-
}
68+
value = (length(aws_macie2_organization_configuration.this) > 0
69+
? {
70+
auto_enable = aws_macie2_organization_configuration.this[0].auto_enable
71+
}
72+
: null
73+
)
7174
}
7275

7376
output "discovery_result_repository" {

0 commit comments

Comments
 (0)