File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
terraform/account-wide-infrastructure/dev Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11
2- # First, we create an S3 bucket for compliance reports.
32resource "aws_s3_bucket" "backup_reports" {
43 bucket_prefix = " ${ local . prefix } -backup-reports"
54}
@@ -45,6 +44,22 @@ resource "aws_s3_bucket_policy" "backup_reports_bucket_policy" {
4544 }
4645 }
4746 },
47+ {
48+ Sid = " AllowBackupReportsWrite"
49+ Effect = " Allow"
50+ Principal = {
51+ AWS = " arn:aws:iam::${ local . account_id } :role/aws-service-role/reports.backup.amazonaws.com/AWSServiceRoleForBackupReports"
52+ }
53+ Action = " s3:PutObject"
54+ Resource = [
55+ " ${ aws_s3_bucket . backup_reports . arn } /*" ,
56+ ]
57+ Condition = {
58+ StringEquals = {
59+ " s3:x-amz-acl" = " bucket-owner-full-control"
60+ }
61+ }
62+ }
4863 ]
4964 })
5065}
Original file line number Diff line number Diff line change 11data "aws_region" "current" {}
22
3+ data "aws_caller_identity" "current" {}
4+
35data "aws_secretsmanager_secret_version" "identities_account_id" {
46 secret_id = aws_secretsmanager_secret. identities_account_id . name
57}
Original file line number Diff line number Diff line change 33 project = " nhsd-nrlf"
44 environment = terraform. workspace
55 prefix = " ${ local . project } --${ local . environment } "
6+ account_id = data. aws_caller_identity . current . account_id
67
78 notification_emails = tolist (jsondecode (data. aws_secretsmanager_secret_version . emails . secret_string ))
89}
You can’t perform that action at this time.
0 commit comments