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

AWS_CE_COST_CATEGORY: be able to use nested operands like you can via aws api #30862

Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions .changelog/30862.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_ce_cost_category: Allow up to 3 levels of `and`, not` and `or` operand nesting for the `rule` argument
```
8 changes: 4 additions & 4 deletions internal/service/ce/anomaly_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
MaxItems: 1,
Computed: true,
Optional: true,
Elem: elemExpression(),
Elem: expressionElem(2),

Check failure on line 99 in internal/service/ce/anomaly_subscription.go

View workflow job for this annotation

GitHub Actions / 2 of 2

mnd: Magic number: 2, in <argument> detected (gomnd)
},
},

Expand Down Expand Up @@ -124,7 +124,7 @@
}

if v, ok := d.GetOk("threshold_expression"); ok {
input.AnomalySubscription.ThresholdExpression = expandCostExpression(v.([]interface{})[0].(map[string]interface{}))
input.AnomalySubscription.ThresholdExpression = expandExpression(v.([]interface{})[0].(map[string]interface{}))
}

output, err := conn.CreateAnomalySubscription(ctx, input)
Expand Down Expand Up @@ -160,7 +160,7 @@
d.Set("monitor_arn_list", subscription.MonitorArnList)
d.Set("name", subscription.SubscriptionName)
d.Set("subscriber", flattenSubscribers(subscription.Subscribers))
if err := d.Set("threshold_expression", []interface{}{flattenCostCategoryRuleExpression(subscription.ThresholdExpression)}); err != nil {
if err := d.Set("threshold_expression", []interface{}{flattenExpression(subscription.ThresholdExpression)}); err != nil {
return sdkdiag.AppendErrorf(diags, "setting threshold_expression: %s", err)
}

Expand Down Expand Up @@ -190,7 +190,7 @@
}

if d.HasChange("threshold_expression") {
input.ThresholdExpression = expandCostExpression(d.Get("threshold_expression").([]interface{})[0].(map[string]interface{}))
input.ThresholdExpression = expandExpression(d.Get("threshold_expression").([]interface{})[0].(map[string]interface{}))
}

_, err := conn.UpdateAnomalySubscription(ctx, input)
Expand Down
Loading
Loading