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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Budget with multiple TagKeyValue cost filters #5890

Closed
dmrzzz opened this issue Sep 14, 2018 · 6 comments
Closed

Budget with multiple TagKeyValue cost filters #5890

dmrzzz opened this issue Sep 14, 2018 · 6 comments

Comments

@dmrzzz
Copy link

@dmrzzz dmrzzz commented Sep 14, 2018

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I want to create a Budget with more than one TagKeyValue in cost_filters. AWS supports this, but AFAICT Terraform currently does not.

New or Affected Resource(s)

  • aws_budgets_budget

Potential Terraform Configuration

provider "aws" {
  region = "us-east-2"
}

resource "aws_budgets_budget" "test" {
  name              = "test"
  budget_type       = "COST"
  limit_amount      = "500"
  limit_unit        = "USD"
  time_unit         = "MONTHLY"
  time_period_start = "2018-01-01_00:00"

  cost_filters {
    TagKeyValue = ["user:Service$IP Address Management", "user:Environment$Dev"]
  }

  cost_types {
    use_amortized = true
  }
}

Currently (Terraform v0.11.8, provider.aws v1.36.0) this fails with

Error: aws_budgets_budget.test: cost_filters (TagKeyValue): '' expected type 'string', got unconvertible type '[]interface {}'

etc

Just for fun, let's comment out the TagKeyValue line above and then terraform apply (creating a Budget with no cost_filters). Now I can add my desired filters manually using the AWS web console.

At this point, we can see that AWS CLI returns an array for TagKeyValue (hence my belief that Terraform ought to accept an array for it):

$ aws budgets describe-budget --account-id 378517677616 --budget-name test
{
    "Budget": {
        "BudgetType": "COST",
        "TimePeriod": {
            "End": 3706473600.0,
            "Start": 1535760000.0
        },
        "CalculatedSpend": {
            "ActualSpend": {
                "Unit": "USD",
                "Amount": "0"
            }
        },
        "CostTypes": {
            "UseBlended": false,
            "IncludeCredit": true,
            "IncludeSubscription": true,
            "IncludeRecurring": true,
            "IncludeUpfront": true,
            "UseAmortized": true,
            "IncludeSupport": true,
            "IncludeDiscount": true,
            "IncludeRefund": true,
            "IncludeTax": true,
            "IncludeOtherSubscription": true
        },
        "BudgetName": "test",
        "BudgetLimit": {
            "Unit": "USD",
            "Amount": "500"
        },
        "TimeUnit": "MONTHLY",
        "CostFilters": {
            "TagKeyValue": [
                "user:Service$IP Address Management",
                "user:Environment$Dev"
            ]
        }
    }
}
@mozamimy
Copy link
Contributor

@mozamimy mozamimy commented Apr 23, 2019

I'm interested in working on this issue.

I think other keys of cost_filters include the same problem. For example, Region, LinkedAccount, etc.

I'm going to create a pull request to fix it. However, it may take a while since I'm a beginner of terraform-provider-aws's implementation.

@ButterflyServiceDesk
Copy link

@ButterflyServiceDesk ButterflyServiceDesk commented Sep 19, 2019

Just to add to this I have been trying to create a simple budget as well that filters for multiple linked accounts. Below is an example:
cost_filters = { LinkedAccount = "111111111,222222222,3333333333,444444444,555555555" }

Now when you apply this it actually creates a filter for an account "111111111,222222222,3333333333,444444444,555555555" and not a filter for each account. I have also tried it with spaces after the commas.

Even did a test were I manually created a budget in AWS, added the filter and then did a terraform import. Copied the filter from the state file and used that to create a new budget and still no dice.

Do we have any idea when this will be fixed considering it was originally reported in april?

Regards

@dmrzzz
Copy link
Author

@dmrzzz dmrzzz commented Jun 18, 2021

Just noticed this interesting comment in a newer issue: #13288 (comment)

@elior379
Copy link

@elior379 elior379 commented Jun 20, 2021

Any news about it?

We really need it

@github-actions
Copy link

@github-actions github-actions bot commented Jul 29, 2021

This functionality has been released in v3.52.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

@github-actions github-actions bot commented Aug 29, 2021

I'm going to lock this issue because it has been closed for 30 days . This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants