Skip to content

Commit

Permalink
add cost_types (#10)
Browse files Browse the repository at this point in the history
* add cost_types

* Auto Format

Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 17, 2022
1 parent db1044c commit 9d17ca7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/complete/fixtures.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ budgets = [
Service = ["Amazon Elastic Compute Cloud - Compute"]
}

cost_types = {
include_credit = true
include_discount = true
include_other_subscription = false
include_recurring = true
include_refund = false
include_subscription = true
include_support = false
include_tax = true
include_upfront = false
use_blended = false
}

notification = {
comparison_operator = "GREATER_THAN"
threshold = "100"
Expand Down
17 changes: 17 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ resource "aws_budgets_budget" "default" {
time_period_end = lookup(each.value, "time_period_end", null)
time_unit = each.value.time_unit

dynamic "cost_types" {
for_each = lookup(each.value, "cost_types", null) != null ? [each.value.cost_types] : []

content {
include_credit = lookup(cost_types.value, "include_credit", null)
include_discount = lookup(cost_types.value, "include_discount", null)
include_other_subscription = lookup(cost_types.value, "include_other_subscription", null)
include_recurring = lookup(cost_types.value, "include_recurring", null)
include_refund = lookup(cost_types.value, "include_refund", null)
include_subscription = lookup(cost_types.value, "include_subscription", null)
include_support = lookup(cost_types.value, "include_support", null)
include_tax = lookup(cost_types.value, "include_tax", null)
include_upfront = lookup(cost_types.value, "include_upfront", null)
use_blended = lookup(cost_types.value, "use_blended", null)
}
}

dynamic "cost_filter" {
for_each = lookup(each.value, "cost_filter", null) != null ? each.value.cost_filter : {}

Expand Down

0 comments on commit 9d17ca7

Please sign in to comment.