Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set custom name for CUR bucket #956

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions terraform-modules/cur-setup-source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ Type: `string`

The following input variables are optional (have default values):

### cur\_bucket\_name

Description: S3 Bucket name for CUR

Type: `string`

Default: `null`

### cur\_name\_suffix

Description: Suffix used to name the CUR report
Expand Down
6 changes: 5 additions & 1 deletion terraform-modules/cur-setup-source/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ data "aws_caller_identity" "this" {}
data "aws_partition" "this" {}
data "aws_region" "this" {}

locals {
cur_bucket_name = var.cur_bucket_name != null ? var.cur_bucket_name : "${var.resource_prefix}-${data.aws_caller_identity.this.account_id}-local"
}

###
# CUR S3 Bucket
###
resource "aws_s3_bucket" "this" {
# checkov:skip=CKV2_AWS_62:Due to dependencies, S3 event notifications must be configured external to the module
bucket = "${var.resource_prefix}-${data.aws_caller_identity.this.account_id}-local"
bucket = local.cur_bucket_name
force_destroy = true

tags = var.tags
Expand Down
6 changes: 6 additions & 0 deletions terraform-modules/cur-setup-source/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "cur_bucket_name" {
type = string
description = "S3 Bucket name for CUR(optional)"
default = null
}

variable "destination_bucket_arn" {
type = string
description = "Destination Bucket ARN"
Expand Down