-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Refactor
ingress
/ egress
in `analytical-platform-data-product…
…ion` (#6803) * ♻️ Refactor * 🔧 Specify Replication permissions
- Loading branch information
Showing
6 changed files
with
72 additions
and
171 deletions.
There are no files selected for viewing
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
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
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
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
14 changes: 14 additions & 0 deletions
14
terraform/aws/analytical-platform-data-production/ingestion-ingress/kms-keys.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "production_cica_dms_kms" { | ||
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions | ||
#checkov:skip=CKV_TF_2:Module registry does not support tags for versions | ||
|
||
source = "terraform-aws-modules/kms/aws" | ||
version = "3.1.1" | ||
|
||
aliases = ["s3/mojap-data-production-cica-dms-ingress-production"] | ||
description = "MoJ AP CICA DMS Ibgress - Production" | ||
enable_default_policy = true | ||
multi_region = true | ||
|
||
deletion_window_in_days = 7 | ||
} |
58 changes: 58 additions & 0 deletions
58
terraform/aws/analytical-platform-data-production/ingestion-ingress/s3.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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
data "aws_iam_policy_document" "cica_dms_ingress_bucket_policy" { | ||
statement { | ||
sid = "ReplicationPermissions" | ||
effect = "Allow" | ||
principals { | ||
type = "AWS" | ||
identifiers = ["arn:aws:iam::471112983409:role/cica-dms-ingress-production-replication"] | ||
} | ||
actions = [ | ||
"s3:ReplicateObject", | ||
"s3:ObjectOwnerOverrideToBucketOwner", | ||
"s3:GetObjectVersionTagging", | ||
"s3:ReplicateTags", | ||
"s3:ReplicateDelete" | ||
] | ||
resources = ["arn:aws:s3:::mojap-data-production-cica-dms-ingress-production/*"] | ||
} | ||
} | ||
|
||
#tfsec:ignore:AVD-AWS-0088:Bucket is encrypted with CMK KMS, but not detected by Trivy | ||
#tfsec:ignore:AVD-AWS-0089:Bucket logging not enabled currently | ||
#tfsec:ignore:AVD-AWS-0132:Bucket is encrypted with CMK KMS, but not detected by Trivy | ||
module "cica_dms_ingress_s3" { | ||
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions | ||
#checkov:skip=CKV_TF_2:Module registry does not support tags for versions | ||
#checkov:skip=CKV_AWS_18:Access logging not enabled currently | ||
#checkov:skip=CKV_AWS_21:Versioning is enabled, but not detected by Checkov | ||
#checkov:skip=CKV_AWS_145:Bucket is encrypted with CMK KMS, but not detected by Checkov | ||
#checkov:skip=CKV_AWS_300:Lifecycle configuration not enabled currently | ||
#checkov:skip=CKV_AWS_144:Cross-region replication is not required currently | ||
#checkov:skip=CKV2_AWS_6:Public access block is enabled, but not detected by Checkov | ||
#checkov:skip=CKV2_AWS_61:Lifecycle configuration not enabled currently | ||
#checkov:skip=CKV2_AWS_62:Bucket notifications not required currently | ||
#checkov:skip=CKV2_AWS_67:Regular CMK key rotation is not required currently | ||
|
||
source = "terraform-aws-modules/s3-bucket/aws" | ||
version = "4.5.0" | ||
|
||
bucket = "mojap-data-production-cica-dms-ingress-production" | ||
|
||
force_destroy = true | ||
|
||
versioning = { | ||
enabled = true | ||
} | ||
|
||
attach_policy = true | ||
policy = data.aws_iam_policy_document.cica_dms_ingress_bucket_policy.json | ||
|
||
server_side_encryption_configuration = { | ||
rule = { | ||
apply_server_side_encryption_by_default = { | ||
kms_master_key_id = module.production_cica_dms_kms.key_arn | ||
sse_algorithm = "aws:kms" | ||
} | ||
} | ||
} | ||
} |