File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,18 +9,21 @@ resource "aws_iam_role" "malware" {
99 partition : data.aws_partition.current.partition
1010 region : data.aws_region.current.region
1111 })))
12+ }
1213
13- inline_policy {
14- name = " ${ local . bucket_name } -malware"
15- policy = jsonencode (yamldecode (templatefile (" ${ path . module } /templates/malware-policy.yaml.tftpl" , {
16- account : data.aws_caller_identity.identity.account_id
17- bucket_arn : module.this.arn
18- kms_key_arn : local.kms_key_arn
19- partition : data.aws_partition.current.partition
20- region : data.aws_region.current.region
21- })))
22- }
14+ resource "aws_iam_role_policy" "malware" {
15+ for_each = var. enable_malware_protection ? toset ([" this" ]) : toset ([])
16+
17+ name = " ${ local . bucket_name } -malware"
18+ role = aws_iam_role. malware [" this" ]. name
2319
20+ policy = jsonencode (yamldecode (templatefile (" ${ path . module } /templates/malware-policy.yaml.tftpl" , {
21+ account : data.aws_caller_identity.identity.account_id
22+ bucket_arn : module.this.arn
23+ kms_key_arn : local.kms_key_arn
24+ partition : data.aws_partition.current.partition
25+ region : data.aws_region.current.region
26+ })))
2427}
2528
2629resource "aws_guardduty_malware_protection_plan" "this" {
You can’t perform that action at this time.
0 commit comments