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

Added ability to create account_name Cost Category #920

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 21 additions & 1 deletion cfn-templates/cur-aggregation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Metadata:
- DestinationAccountId
- ResourcePrefix
- CreateCUR
- CreateCostCategory
- AddSCAD
-
Label:
Expand All @@ -25,7 +26,8 @@ Metadata:
default: "Source Account Ids (Comma separated list)"
AddSCAD:
default: "Add Split Cost Allocation Data (SCAD) to CUR."

CreateCostCategory:
default: "Create account_name Cost Category to be used by all dashboards."

Parameters:

Expand All @@ -51,6 +53,11 @@ Parameters:
Description: Add Split Cost Allocation Data (SCAD) to CUR
AllowedValues: ['yes', 'no']
Default: "no"
CreateCostCategory:
Type: String
Description: Whenever or not create 'accountname' Cost Category. This allows accounts names to be populated in the dashboards.
AllowedValues: ["True", "False"]
Default: "False"

##
# Destination specific params
Expand All @@ -75,6 +82,8 @@ Conditions:
- !Equals [!Ref 'AWS::Region', 'us-east-1']
- !Equals [!Ref 'AWS::Region', 'cn-northwest-1']
CUREnable: !Equals [!Ref CreateCUR, 'True']
CostCategoryEnable: !Equals [!Ref CreateCostCategory, "True"]
DeployCostCategory: !And [!Condition CostCategoryEnable, !Condition IsSourceAccount]
DeployCURViaCFNInSource: !And [!Condition CUREnable, !Condition IsSourceAccount, !Condition RegionSupportsCURviaCFN]
DeployCURViaCFNInDestination: !And [!Condition CUREnable, !Condition IsDestinationAccount, !Condition RegionSupportsCURviaCFN]
DeployCURViaLambda: !And [!Condition CUREnable, !Not [!Condition RegionSupportsCURviaCFN]]
Expand Down Expand Up @@ -388,6 +397,17 @@ Resources:
Resource:
Fn::Sub: "arn:${AWS::Partition}:s3:::${ResourcePrefix}-${DestinationAccountId}-shared/cur/${AWS::AccountId}/*"

####
# Cost Categories - accountname
####
AccountNameCostCategory:
Type: AWS::CE::CostCategory
Condition: DeployCostCategory
Properties:
Name: "accountname"
RuleVersion: CostCategoryExpression.v1
Rules: '[{"Type": "INHERITED_VALUE", "InheritedValue": {"DimensionName": "LINKED_ACCOUNT_NAME"}}]'

####
# Local CUR
####
Expand Down