Skip to content

wearetechnative/terraform-aws-module-cur

Repository files navigation

Terraform AWS [cur]

This module implements Cost and Usage reports in AWS which includes the S3 bucket.

Todo

Lifecycle rules as these S3 buckets can grow quite large.

How does it work

First use after you clone this repository or when .pre-commit-config.yaml is updated

Run pre-commit install to install any guardrails implemented using pre-commit.

See pre-commit installation on how to install pre-commit.

Usage

Basic usage works like below which includes a demonstration of setting up the target in an S3 replication setup.

module "cur" {
  providers = {
    aws = aws.us-east-1
  }

  # source = "[email protected]:TechNative-B-V/modules-aws.git?ref=v1.1.8"
  source = "./modules/cur/"

  name        = local.cur_athena_name
  kms_key_arn = module.kms.kms_key_arn

  s3_source_replication_configuration = {
    "cur" : {
      destination_bucket_arn  = var.finops_replication_bucket_configuration.destination_bucket_arn
      destination_aws_account = aws_organizations_account.finops.id
      destination_kms_key_arn = var.finops_replication_bucket_configuration.destination_kms_key_arn
    }
  }
}

Providers

Name Version
aws >=4.13.0

Modules

Name Source Version
cur_s3 [email protected]:TechNative-B-V/terraform-aws-module-s3.git f95b7fd11f654192a74b7a0f0b7dae1004edf7be

Resources

Name Type
aws_cur_report_definition.this resource
aws_arn.s3_bucket data source
aws_caller_identity.current data source
aws_iam_policy_document.costandusagereport_s3_access data source
aws_partition.current data source
aws_region.current data source
aws_s3_bucket.s3_bucket data source

Inputs

Name Description Type Default Required
additional_artifacts Internal use. Add additional artifacts for different systems. Optional array which includes values ATHENA, REDSHIFT. list(string)
[
"ATHENA"
]
no
format Internal use. Format to store files, currently supports Parquet or textORcsv. string "Parquet" no
kms_key_arn KMS key to use for encrypting RDS instances. string n/a yes
name Name for Athena CUR. string n/a yes
override_s3_fixed_name Set this variable in case of existing S3 bucket that should not be renamed because of current data. Generally for pre-provisioned accounts. string null no
overwrite_report Internal use. Overwrite report on new updates. bool true no
s3_source_replication_configuration Replication target configuration using this bucket as source. The key of the map is used for naming. This is passed to the S3 module.
map(object({
destination_bucket_arn = string
destination_aws_account = string
destination_kms_key_arn = string
}))
{} no

Outputs

Name Description
cur_s3_arn n/a
cur_s3_bucket_name n/a
cur_s3_bucket_replication_source_configuration test
cur_s3_bucket_replication_target_configuration n/a

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages