Skip to content

Commit

Permalink
aws_ce_cost_category: effective start has to be passed for every upda…
Browse files Browse the repository at this point in the history
…te else aws takes the first day of the current month as effective start date
  • Loading branch information
porqueoutai committed Mar 31, 2023
1 parent 88bfbd5 commit 6be41f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/30369.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_ce_cost_explorer: Fixed `effective_start` being reset on any changes despite `effective_start` having the same value
```
5 changes: 1 addition & 4 deletions internal/service/ce/cost_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ func resourceCostCategoryUpdate(ctx context.Context, d *schema.ResourceData, met
if d.HasChangesExcept("tags", "tags_all") {
input := &costexplorer.UpdateCostCategoryDefinitionInput{
CostCategoryArn: aws.String(d.Id()),
EffectiveStart: aws.String(d.Get("effective_start").(string)),
Rules: expandCostCategoryRules(d.Get("rule").(*schema.Set).List()),
RuleVersion: aws.String(d.Get("rule_version").(string)),
}
Expand All @@ -480,10 +481,6 @@ func resourceCostCategoryUpdate(ctx context.Context, d *schema.ResourceData, met
input.SplitChargeRules = expandCostCategorySplitChargeRules(d.Get("split_charge_rule").(*schema.Set).List())
}

if d.HasChange("effective_start") {
input.EffectiveStart = aws.String(d.Get("effective_start").(string))
}

_, err := conn.UpdateCostCategoryDefinitionWithContext(ctx, input)

if err != nil {
Expand Down

0 comments on commit 6be41f4

Please sign in to comment.