An open API service indexing awesome lists of open source software.

https://github.com/wearetechnative/terraform-aws-module-cur


https://github.com/wearetechnative/terraform-aws-module-cur

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Terraform AWS [CUR] ![](https://img.shields.io/github/workflow/status/wearetechnative/terraform-aws-module-cur/tflint.yaml?branch=main&style=plastic)

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.

[![](we-are-technative.png)](https://www.technative.nl)

## 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](https://pre-commit.com/#install) 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.

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

# source = "git@github.com: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](#provider\_aws) | >=4.13.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| [cur\_s3](#module\_cur\_s3) | git@github.com:TechNative-B-V/terraform-aws-module-s3.git | f95b7fd11f654192a74b7a0f0b7dae1004edf7be |

## Resources

| Name | Type |
|------|------|
| [aws_cur_report_definition.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cur_report_definition) | resource |
| [aws_arn.s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.costandusagereport_s3_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_s3_bucket.s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [additional\_artifacts](#input\_additional\_artifacts) | Internal use. Add additional artifacts for different systems. Optional array which includes values ATHENA, REDSHIFT. | `list(string)` |

[
"ATHENA"
]
| no |
| [format](#input\_format) | Internal use. Format to store files, currently supports Parquet or textORcsv. | `string` | `"Parquet"` | no |
| [kms\_key\_arn](#input\_kms\_key\_arn) | KMS key to use for encrypting RDS instances. | `string` | n/a | yes |
| [name](#input\_name) | Name for Athena CUR. | `string` | n/a | yes |
| [override\_s3\_fixed\_name](#input\_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](#input\_overwrite\_report) | Internal use. Overwrite report on new updates. | `bool` | `true` | no |
| [s3\_source\_replication\_configuration](#input\_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](#output\_cur\_s3\_arn) | n/a |
| [cur\_s3\_bucket\_name](#output\_cur\_s3\_bucket\_name) | n/a |
| [cur\_s3\_bucket\_replication\_source\_configuration](#output\_cur\_s3\_bucket\_replication\_source\_configuration) | test |
| [cur\_s3\_bucket\_replication\_target\_configuration](#output\_cur\_s3\_bucket\_replication\_target\_configuration) | n/a |