diff --git a/infrastructure/terraform/components/dl/README.md b/infrastructure/terraform/components/dl/README.md index 43435531..2c63a999 100644 --- a/infrastructure/terraform/components/dl/README.md +++ b/infrastructure/terraform/components/dl/README.md @@ -45,7 +45,7 @@ No requirements. | [metadata\_refresh\_schedule](#input\_metadata\_refresh\_schedule) | Schedule for refreshing reporting metadata. | `string` | `"cron(10 6-22 * * ? *)"` | no | | [parent\_acct\_environment](#input\_parent\_acct\_environment) | Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments | `string` | `"main"` | no | | [pii\_data\_retention\_non\_current\_days](#input\_pii\_data\_retention\_non\_current\_days) | The number of non current days for data retention policy for PII | `number` | `14` | no | -| [pii\_data\_retention\_policy\_days](#input\_pii\_data\_retention\_policy\_days) | The number of days for data retention policy for PII | `number` | `534` | no | +| [pii\_data\_retention\_policy\_days](#input\_pii\_data\_retention\_policy\_days) | The number of days for data retention policy for PII | `number` | `90` | no | | [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes | | [queue\_batch\_size](#input\_queue\_batch\_size) | maximum number of queue items to process | `number` | `10` | no | | [queue\_batch\_window\_seconds](#input\_queue\_batch\_window\_seconds) | maximum time in seconds between processing events | `number` | `1` | no | diff --git a/infrastructure/terraform/components/dl/module_s3bucket_pii_data.tf b/infrastructure/terraform/components/dl/module_s3bucket_pii_data.tf index c9c72942..921121b1 100644 --- a/infrastructure/terraform/components/dl/module_s3bucket_pii_data.tf +++ b/infrastructure/terraform/components/dl/module_s3bucket_pii_data.tf @@ -15,6 +15,24 @@ module "s3bucket_pii_data" { force_destroy = var.force_destroy + lifecycle_rules = [ + { + enabled = true + + expiration = { + days = var.pii_data_retention_policy_days + } + + noncurrent_version_expiration = { + noncurrent_days = var.pii_data_retention_non_current_days + } + + abort_incomplete_multipart_upload = { + days = "1" + } + } + ] + default_tags = { NHSE-Enable-S3-Backup-Acct = "True" } diff --git a/infrastructure/terraform/components/dl/variables.tf b/infrastructure/terraform/components/dl/variables.tf index 96a18682..8c1446de 100644 --- a/infrastructure/terraform/components/dl/variables.tf +++ b/infrastructure/terraform/components/dl/variables.tf @@ -204,7 +204,7 @@ variable "report_scheduler_schedule" { variable "pii_data_retention_policy_days" { type = number description = "The number of days for data retention policy for PII" - default = 534 + default = 90 } variable "pii_data_retention_non_current_days" {