File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ data "aws_caller_identity" "current" {}
2+ data "aws_region" "current" {}
3+
4+ locals {
5+ asset_bucket_prefix = " ${ data . aws_caller_identity . current . account_id } -${ var . ProjectId } "
6+ }
7+
8+ module "buckets" {
9+ source = " git::https://github.com/acm-uiuc/terraform-modules.git//multiregion-s3?ref=99de4c350d1e35931f94499e0c06cbf29d0d5b8a"
10+ Region1 = var. PrimaryRegion
11+ Region2 = var. SecondaryRegion
12+ BucketPrefix = local. asset_bucket_prefix
13+ }
14+
15+ resource "aws_s3_bucket_lifecycle_configuration" "expire_noncurrent" {
16+ for_each = module. buckets . buckets_info
17+ bucket = each. value . id
18+
19+ rule {
20+ id = " expire-noncurrent-versions"
21+ status = " Enabled"
22+
23+ noncurrent_version_expiration {
24+ noncurrent_days = 3
25+ }
26+ }
27+
28+ rule {
29+ id = " expire-delete-markers"
30+ status = " Enabled"
31+
32+ expiration {
33+ expired_object_delete_marker = true
34+ }
35+ }
36+
37+ rule {
38+ id = " abort-incomplete-multipart"
39+ status = " Enabled"
40+
41+ abort_incomplete_multipart_upload {
42+ days_after_initiation = 3
43+ }
44+ }
45+ }
Original file line number Diff line number Diff line change 1+ variable "PrimaryRegion" {
2+ type = string
3+ default = " us-east-2"
4+ }
5+
6+ variable "SecondaryRegion" {
7+ type = string
8+ default = " us-west-2"
9+ }
10+
11+ variable "ProjectId" {
12+ type = string
13+ description = " Prefix before each resource"
14+ }
You can’t perform that action at this time.
0 commit comments