Skip to content

Commit

Permalink
Update replication metrics to be block (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalmeribm authored Apr 16, 2024
1 parent 29c5c10 commit 3869c8a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
77 changes: 40 additions & 37 deletions modules/aws/cost_usage_reports/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ provider "aws" {
}

provider "aws" {
region = "us-east-1"
alias = "us-east-1"
region = "us-east-1"
alias = "us-east-1"
}

#COST AND USAGE REPORT
resource "aws_cur_report_definition" "cur_report_definitions" {
depends_on = [aws_iam_role.cur_role, aws_s3_bucket_policy.cur_S3_bucket_policy]
depends_on = [aws_iam_role.cur_role, aws_s3_bucket_policy.cur_S3_bucket_policy]
provider = aws.us-east-1
report_name = var.report_name
time_unit = var.time_unit
Expand Down Expand Up @@ -131,39 +131,39 @@ resource "aws_s3_bucket_policy" "cur_S3_bucket_policy" {
bucket = aws_s3_bucket.s3_buckets.id
policy = jsonencode({
"Version" : "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "billingreports.amazonaws.com"
},
"Action": [
"s3:GetBucketAcl",
"s3:GetBucketPolicy"
],
"Resource": aws_s3_bucket.s3_buckets.arn,
"Condition": {
"StringEquals": {
"aws:SourceAccount": var.billing_account,
"aws:SourceArn": "arn:aws:cur:us-east-1:${var.billing_account}:definition/*"
}
}
},
{
"Effect": "Allow",
"Principal": {
"Service": "billingreports.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "${aws_s3_bucket.s3_buckets.arn}/*",
"Condition": {
"StringEquals": {
"aws:SourceAccount": var.billing_account,
"aws:SourceArn": "arn:aws:cur:us-east-1:${var.billing_account}:definition/*"
}
}
}
]
"Statement" : [
{
"Effect" : "Allow",
"Principal" : {
"Service" : "billingreports.amazonaws.com"
},
"Action" : [
"s3:GetBucketAcl",
"s3:GetBucketPolicy"
],
"Resource" : aws_s3_bucket.s3_buckets.arn,
"Condition" : {
"StringEquals" : {
"aws:SourceAccount" : var.billing_account,
"aws:SourceArn" : "arn:aws:cur:us-east-1:${var.billing_account}:definition/*"
}
}
},
{
"Effect" : "Allow",
"Principal" : {
"Service" : "billingreports.amazonaws.com"
},
"Action" : "s3:PutObject",
"Resource" : "${aws_s3_bucket.s3_buckets.arn}/*",
"Condition" : {
"StringEquals" : {
"aws:SourceAccount" : var.billing_account,
"aws:SourceArn" : "arn:aws:cur:us-east-1:${var.billing_account}:definition/*"
}
}
}
]
})
}

Expand Down Expand Up @@ -201,7 +201,10 @@ resource "aws_s3_bucket_replication_configuration" "cur_bucket_replication_rule"
destination {
bucket = var.destination_bucket
storage_class = "STANDARD"
metrics = "Enabled"

metrics {
status = "Enabled"
}
}

delete_marker_replication {
Expand Down
2 changes: 1 addition & 1 deletion modules/aws/cost_usage_reports/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ variable "additional_schema_elements" {
description = "A list of schema elements."

validation {
condition = contains(var.additional_schema_elements, "RESOURCES") || contains(var.additional_schema_elements, "SPLIT_COST_ALLOCATION_DATA" )
condition = contains(var.additional_schema_elements, "RESOURCES") || contains(var.additional_schema_elements, "SPLIT_COST_ALLOCATION_DATA")
error_message = "Valid values for additional_schema_elements are (RESOURCES, SPLIT_COST_ALLOCATION_DATA)"
}
}
Expand Down

0 comments on commit 3869c8a

Please sign in to comment.