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

r/aws_budgets_budget: Deprecate cost_filters argument #22888

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/22888.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:note
resource/aws_budgets_budget: The `cost_filters` attribute has been deprecated. Use the `cost_filter` attribute instead.
```
1 change: 1 addition & 0 deletions internal/service/budgets/budget.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func ResourceBudget() *schema.Resource {
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
ConflictsWith: []string{"cost_filter"},
Deprecated: "Use the attribute \"cost_filter\" instead.",
},
"cost_filter": {
Type: schema.TypeSet,
Expand Down
6 changes: 3 additions & 3 deletions internal/service/budgets/budget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAccBudgetsBudget_basic(t *testing.T) {
CheckDestroy: testAccBudgetDestroy,
Steps: []resource.TestStep{
{
Config: testAccBudgetConfig(rName),
Config: testAccBudgetConfigDeprecated(rName),
Check: resource.ComposeTestCheckFunc(
testAccBudgetExists(resourceName, &budget),
acctest.CheckResourceAttrAccountID(resourceName, "account_id"),
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestAccBudgetsBudget_disappears(t *testing.T) {
CheckDestroy: testAccBudgetDestroy,
Steps: []resource.TestStep{
{
Config: testAccBudgetConfig(rName),
Config: testAccBudgetConfigDeprecated(rName),
Check: resource.ComposeTestCheckFunc(
testAccBudgetExists(resourceName, &budget),
acctest.CheckResourceDisappears(acctest.Provider, tfbudgets.ResourceBudget(), resourceName),
Expand Down Expand Up @@ -405,7 +405,7 @@ func testAccBudgetDestroy(s *terraform.State) error {
return nil
}

func testAccBudgetConfig(rName string) string {
func testAccBudgetConfigDeprecated(rName string) string {
return fmt.Sprintf(`
resource "aws_budgets_budget" "test" {
name = %[1]q
Expand Down
13 changes: 8 additions & 5 deletions website/docs/r/budgets_budget.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,17 @@ resource "aws_budgets_budget" "ri_utilization" {
}

# RI Utilization plans require a service cost filter to be set
cost_filters = {
Service = "Amazon Relational Database Service"
cost_filter = {
name = "Service"
values = [
"Amazon Relational Database Service",
]
}
}
```

## Argument Reference

~> **NOTE:** The `cost_filters` attribute will be deprecated and eventually removed in future releases, please use `cost_filter` instead.

For more detailed documentation about each argument, refer to the [AWS official
documentation](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/data-type-budget.html).

Expand All @@ -129,7 +130,7 @@ The following arguments are supported:
* `name_prefix` - (Optional) The prefix of the name of a budget. Unique within accounts.
* `budget_type` - (Required) Whether this budget tracks monetary cost or usage.
* `cost_filter` - (Optional) A list of [CostFilter](#Cost-Filter) name/values pair to apply to budget.
* `cost_filters` - (Optional) Map of [CostFilters](#Cost-Filters) key/value pairs to apply to the budget.
* `cost_filters` - (Optional, **Deprecated**) Map of [CostFilters](#Cost-Filters) key/value pairs to apply to the budget.
* `cost_types` - (Optional) Object containing [CostTypes](#Cost-Types) The types of cost included in a budget, such as tax and subscriptions.
* `limit_amount` - (Required) The amount of cost or usage being measured for a budget.
* `limit_unit` - (Required) The unit of measurement used for the budget forecast, actual spend, or budget threshold, such as dollars or GB. See [Spend](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/data-type-spend.html) documentation.
Expand Down Expand Up @@ -186,6 +187,8 @@ Refer to [AWS CostFilter documentation](http://docs.aws.amazon.com/awsaccountbil

### Cost Filters

**Note**: Attribute `cost_filters` is deprecated. Use `cost_filter` instead.

Valid key for `cost_filters` is same as `cost_filter`. Please refer to [Cost Filter](#Cost-Filter).

### Budget Notification
Expand Down