Skip to content

Latest commit

 

History

History
198 lines (129 loc) · 6.61 KB

File metadata and controls

198 lines (129 loc) · 6.61 KB

CID Terraform Module: cur-setup-source

Terraform module to set up a Cost and Usage Report in a source (payer) account for use in Cost Intelligence Dashboards. The module creates an S3 bucket with the necessary permissions and configuration to replicate CUR data to the destination/aggregation account. If you are deploying Cost Intelligence Cashboards for a multi-payer environment, you can one instance of this module for each payer account.

Example Usage

Note

For complete usage documentation of using this module together with the cur-setup-destination module, refer to the main Terraform Deployment Instructions.

provider "aws" {
  region = "us-west-2"
}

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

# Configure one or more source (payer) accounts
module "cur_source" {
  source = "github.com/aws-samples/aws-cudos-framework-deployment//terraform-modules/cur-setup-source"

  destination_bucket_arn = "UPDATEME"

  # Provider alias for us-east-1 must be passed explicitly (required for CUR setup)
  providers = {
    aws.useast1 = aws.useast1
  }
}

Version Locking

For production deployments, you should lock the version of this module to a release tag to better control when and what updates are made. To specify the release tag to use, append ?ref=VERSION to the module source. For example, the following source reference will use the Terraform module and Cloudformation template from version 0.2.13 of this module:

source = "github.com/aws-samples/aws-cudos-framework-deployment//terraform-modules/cur-setup-source?ref=0.2.13"

For a complete list of release tags, visit https://github.com/aws-samples/aws-cudos-framework-deployment/tags.

Note: The same syntax can be used to use pre-release/beta versions by specifying a branch name instead of a tag name

Requirements

The following requirements are needed by this module:

  • terraform (>= 1.0)

  • aws (>= 3.0)

Providers

The following providers are used by this module:

  • aws (>= 3.0)

  • aws.useast1 (>= 3.0)

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

destination_bucket_arn

Description: Destination Bucket ARN

Type: string

Optional Inputs

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

cur_name_suffix

Description: Suffix used to name the CUR report

Type: string

Default: "cur"

enable_split_cost_allocation_data

Description: Enable split cost allocation data for ECS and EKS for this CUR report

Type: bool

Default: false

kms_key_id

Description: !!!WARNING!!! EXPERIMENTAL - Do not use unless you know what you are doing. The correct key policies and IAM permissions
on the S3 replication role must be configured external to this module.

Type: string

Default: null

resource_prefix

Description: Prefix used for all named resources, including the S3 Bucket

Type: string

Default: "cid"

s3_access_logging

Description: S3 Access Logging configuration for the CUR bucket

Type:

object({
    enabled = bool
    bucket  = string
    prefix  = string
  })

Default:

{
  "bucket": null,
  "enabled": false,
  "prefix": null
}

tags

Description: Map of tags to apply to module resources

Type: map(string)

Default: {}

Outputs

The following outputs are exported:

cur_bucket_arn

Description: ARN of the S3 Bucket where the Cost and Usage Report is delivered

cur_bucket_name

Description: Name of the S3 Bucket where the Cost and Usage Report is delivered

cur_report_arn

Description: ARN of the Cost and Usage Report

replication_role_arn

Description: ARN of the IAM role created for S3 replication

replication_role_name

Description: ARN of the IAM role created for S3 replication