generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9460 from ministryofjustice/revert-pr-9263
Reverts 9263
- Loading branch information
Showing
1 changed file
with
0 additions
and
43 deletions.
There are no files selected for viewing
43 changes: 0 additions & 43 deletions
43
terraform/environments/core-shared-services/s3_malware_protection.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +0,0 @@ | ||
# Variable to allow bucket selection | ||
variable "buckets_to_protect" { | ||
description = <<EOF | ||
Enter the pre-existing bucket names you want to enable malware protection for. | ||
Bucket names must be separated by commas (e.g., bucket1,bucket2,bucket3). | ||
To enable for all buckets, list all bucket names here. | ||
EOF | ||
type = string | ||
default = "mod-platform-image-artefact-bucket20230203091453221500000001,modernisation-platform-software20230224000709766100000001" | ||
} | ||
|
||
# Define the list of buckets to protect | ||
locals { | ||
bucket_list = toset(split(",", replace(trimspace(var.buckets_to_protect), " ", ""))) | ||
} | ||
|
||
# GuardDuty Malware Protection Plan | ||
resource "aws_guardduty_malware_protection_plan" "malware_protection_plan" { | ||
for_each = local.bucket_list | ||
|
||
role = data.aws_iam_role.mp_access.arn | ||
|
||
protected_resource { | ||
s3_bucket { | ||
bucket_name = each.key | ||
} | ||
} | ||
|
||
actions { | ||
tagging { | ||
status = "ENABLED" | ||
} | ||
} | ||
|
||
tags = { | ||
"Name" = "GuardDutyMalwareProtectionPlan-${each.key}" # Unique tag for each bucket | ||
} | ||
} | ||
|
||
|
||
data "aws_iam_role" "mp_access" { | ||
name = "ModernisationPlatformAccess" | ||
} | ||