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

Open
dmrzzz opened this issue Sep 14, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@dmrzzz
Copy link

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

This comment has been minimized.

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.