Skip to content

Commit

Permalink
DOM-51856 - update cur lifecycle (#196)
Browse files Browse the repository at this point in the history
* update cur lifecycle

* updated for linters
  • Loading branch information
ddl-olsonJD authored Jan 11, 2024
1 parent 03830da commit c33c266
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 7 deletions.
2 changes: 0 additions & 2 deletions examples/tfvars/cost-usage-report.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ storage = {
force_destroy_on_deletion = true
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@
"Resource": "*"
}
]
}
}
2 changes: 1 addition & 1 deletion modules/eks/submodules/privatelink/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ resource "aws_iam_policy" "load_balancer_controller" {
resource "aws_iam_role_policy_attachment" "load_balancer_controller" {
role = aws_iam_role.load_balancer_controller.name
policy_arn = aws_iam_policy.load_balancer_controller.arn
}
}
2 changes: 1 addition & 1 deletion modules/eks/submodules/privatelink/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
data "aws_partition" "current" {}
data "aws_partition" "current" {}
2 changes: 1 addition & 1 deletion modules/eks/submodules/privatelink/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ terraform {
version = "~> 5.0"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ resource "aws_route53_record" "service_endpoint_private_dns_verification" {
records = [
aws_vpc_endpoint_service.vpc_endpoint_services[each.key].private_dns_name_configuration[0].value
]
}
}
2 changes: 2 additions & 0 deletions modules/infra/submodules/cost-usage-report/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ No modules.
| [aws_lambda_permission.aws_s3_cur_event_lambda_permission](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
| [aws_s3_bucket.athena_result](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket.cur_report](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.athena_result](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.cur_report](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_notification.aws_put_s3_cur_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) | resource |
| [aws_s3_bucket_policy.athena_result](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_policy.cur_report](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
Expand Down
58 changes: 58 additions & 0 deletions modules/infra/submodules/cost-usage-report/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ resource "aws_s3_bucket" "athena_result" {
tags = var.tags
}

resource "aws_s3_bucket_lifecycle_configuration" "athena_result" {

bucket = aws_s3_bucket.athena_result.id

rule {
id = "AthenaResultsExpiration"

expiration {
days = 3
}

status = "Enabled"
}

rule {
id = "incomplete_upload"

abort_incomplete_multipart_upload {
days_after_initiation = 3
}

status = "Enabled"
}

depends_on = [
aws_s3_bucket.athena_result
]
}

resource "aws_s3_bucket_public_access_block" "athena_result" {
bucket = aws_s3_bucket.athena_result.id

Expand Down Expand Up @@ -51,6 +80,35 @@ resource "aws_s3_bucket" "cur_report" {
tags = var.tags
}

resource "aws_s3_bucket_lifecycle_configuration" "cur_report" {

bucket = aws_s3_bucket.cur_report.id

rule {
id = "CostUsageReportExpiration"

expiration {
days = 7
}

status = "Enabled"
}

rule {
id = "incomplete_upload"

abort_incomplete_multipart_upload {
days_after_initiation = 7
}

status = "Enabled"
}

depends_on = [
aws_s3_bucket.cur_report
]
}

resource "aws_s3_bucket_public_access_block" "cur_report" {
bucket = aws_s3_bucket.cur_report.id

Expand Down

0 comments on commit c33c266

Please sign in to comment.