Cost Category
Provides a CE Cost Category.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.costexplorer.CostCategory("test", {
name: "NAME",
ruleVersion: "CostCategoryExpression.v1",
rules: [
{
value: "production",
rule: {
dimension: {
key: "LINKED_ACCOUNT_NAME",
values: ["-prod"],
matchOptions: ["ENDS_WITH"],
},
},
},
{
value: "staging",
rule: {
dimension: {
key: "LINKED_ACCOUNT_NAME",
values: ["-stg"],
matchOptions: ["ENDS_WITH"],
},
},
},
{
value: "testing",
rule: {
dimension: {
key: "LINKED_ACCOUNT_NAME",
values: ["-dev"],
matchOptions: ["ENDS_WITH"],
},
},
},
],
});
import pulumi
import pulumi_aws as aws
test = aws.costexplorer.CostCategory("test",
name="NAME",
rule_version="CostCategoryExpression.v1",
rules=[
{
"value": "production",
"rule": {
"dimension": {
"key": "LINKED_ACCOUNT_NAME",
"values": ["-prod"],
"match_options": ["ENDS_WITH"],
},
},
},
{
"value": "staging",
"rule": {
"dimension": {
"key": "LINKED_ACCOUNT_NAME",
"values": ["-stg"],
"match_options": ["ENDS_WITH"],
},
},
},
{
"value": "testing",
"rule": {
"dimension": {
"key": "LINKED_ACCOUNT_NAME",
"values": ["-dev"],
"match_options": ["ENDS_WITH"],
},
},
},
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.CostExplorer.CostCategory("test", new()
{
Name = "NAME",
RuleVersion = "CostCategoryExpression.v1",
Rules = new[]
{
new Aws.CostExplorer.Inputs.CostCategoryRuleArgs
{
Value = "production",
Rule = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleArgs
{
Dimension = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleDimensionArgs
{
Key = "LINKED_ACCOUNT_NAME",
Values = new[]
{
"-prod",
},
MatchOptions = new[]
{
"ENDS_WITH",
},
},
},
},
new Aws.CostExplorer.Inputs.CostCategoryRuleArgs
{
Value = "staging",
Rule = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleArgs
{
Dimension = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleDimensionArgs
{
Key = "LINKED_ACCOUNT_NAME",
Values = new[]
{
"-stg",
},
MatchOptions = new[]
{
"ENDS_WITH",
},
},
},
},
new Aws.CostExplorer.Inputs.CostCategoryRuleArgs
{
Value = "testing",
Rule = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleArgs
{
Dimension = new Aws.CostExplorer.Inputs.CostCategoryRuleRuleDimensionArgs
{
Key = "LINKED_ACCOUNT_NAME",
Values = new[]
{
"-dev",
},
MatchOptions = new[]
{
"ENDS_WITH",
},
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/costexplorer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := costexplorer.NewCostCategory(ctx, "test", &costexplorer.CostCategoryArgs{
Name: pulumi.String("NAME"),
RuleVersion: pulumi.String("CostCategoryExpression.v1"),
Rules: costexplorer.CostCategoryRuleArray{
&costexplorer.CostCategoryRuleArgs{
Value: pulumi.String("production"),
Rule: &costexplorer.CostCategoryRuleRuleArgs{
Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
Key: pulumi.String("LINKED_ACCOUNT_NAME"),
Values: pulumi.StringArray{
pulumi.String("-prod"),
},
MatchOptions: pulumi.StringArray{
pulumi.String("ENDS_WITH"),
},
},
},
},
&costexplorer.CostCategoryRuleArgs{
Value: pulumi.String("staging"),
Rule: &costexplorer.CostCategoryRuleRuleArgs{
Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
Key: pulumi.String("LINKED_ACCOUNT_NAME"),
Values: pulumi.StringArray{
pulumi.String("-stg"),
},
MatchOptions: pulumi.StringArray{
pulumi.String("ENDS_WITH"),
},
},
},
},
&costexplorer.CostCategoryRuleArgs{
Value: pulumi.String("testing"),
Rule: &costexplorer.CostCategoryRuleRuleArgs{
Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
Key: pulumi.String("LINKED_ACCOUNT_NAME"),
Values: pulumi.StringArray{
pulumi.String("-dev"),
},
MatchOptions: pulumi.StringArray{
pulumi.String("ENDS_WITH"),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.costexplorer.CostCategory;
import com.pulumi.aws.costexplorer.CostCategoryArgs;
import com.pulumi.aws.costexplorer.inputs.CostCategoryRuleArgs;
import com.pulumi.aws.costexplorer.inputs.CostCategoryRuleRuleArgs;
import com.pulumi.aws.costexplorer.inputs.CostCategoryRuleRuleDimensionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new CostCategory("test", CostCategoryArgs.builder()
.name("NAME")
.ruleVersion("CostCategoryExpression.v1")
.rules(
CostCategoryRuleArgs.builder()
.value("production")
.rule(CostCategoryRuleRuleArgs.builder()
.dimension(CostCategoryRuleRuleDimensionArgs.builder()
.key("LINKED_ACCOUNT_NAME")
.values("-prod")
.matchOptions("ENDS_WITH")
.build())
.build())
.build(),
CostCategoryRuleArgs.builder()
.value("staging")
.rule(CostCategoryRuleRuleArgs.builder()
.dimension(CostCategoryRuleRuleDimensionArgs.builder()
.key("LINKED_ACCOUNT_NAME")
.values("-stg")
.matchOptions("ENDS_WITH")
.build())
.build())
.build(),
CostCategoryRuleArgs.builder()
.value("testing")
.rule(CostCategoryRuleRuleArgs.builder()
.dimension(CostCategoryRuleRuleDimensionArgs.builder()
.key("LINKED_ACCOUNT_NAME")
.values("-dev")
.matchOptions("ENDS_WITH")
.build())
.build())
.build())
.build());
}
}
resources:
test:
type: aws:costexplorer:CostCategory
properties:
name: NAME
ruleVersion: CostCategoryExpression.v1
rules:
- value: production
rule:
dimension:
key: LINKED_ACCOUNT_NAME
values:
- -prod
matchOptions:
- ENDS_WITH
- value: staging
rule:
dimension:
key: LINKED_ACCOUNT_NAME
values:
- -stg
matchOptions:
- ENDS_WITH
- value: testing
rule:
dimension:
key: LINKED_ACCOUNT_NAME
values:
- -dev
matchOptions:
- ENDS_WITH
Import
Using pulumi import
, import aws_ce_cost_category
using the id. For example:
$ pulumi import aws:costexplorer/costCategory:CostCategory example costCategoryARN
Properties
Default value for the cost category.
Effective end data of your Cost Category.
The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example 2022-11-01T00:00:00Z
. The following arguments are optional:
Configuration block for the Cost Category rules used to categorize costs. See below.
Rule schema version in this particular Cost Category.
Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.