0
votes

I'm trying to replicate the process of creating an AWS budget alert in the portal through Terraform.

In the portal, I navigate to Billing, then onto creating Budget and I'm able to create an alert with my conditions for the entire subscription for the budget not to exceed a certain amount otherwise to send an email to a specific group or person.

How do I create the same through Terraform? I don't see any valid documentation for it.

1
aws_budgets_budget and aws_budgets_budget_action are different then what you want?Marcin
This looks like a duplicate of stackoverflow.com/q/68740658/2291321 which you posted a couple of days ago. Please don't post duplicate questions. If you didn't get the answer you wanted you may want to edit the question to provide more details and also consider adding a bounty to the question.ydaetskcoR

1 Answers

0
votes

Budgets use the cost visualisation provided by Cost Explorer to show you the status of your budgets, to provide forecasts of your estimated costs, and to track your AWS usage, including your free tier usage.

Example Usage

resource "aws_budgets_budget" "ec2" {
  name              = "budget-ec2-monthly"
  budget_type       = "COST"
  limit_amount      = "1200"
  limit_unit        = "USD"
  time_period_end   = "2087-06-15_00:00"
  time_period_start = "2017-07-01_00:00"
  time_unit         = "MONTHLY"

  cost_filter {
    name = "Service"
    values = [
      "Amazon Elastic Compute Cloud - Compute",
    ]
  }

  notification {
    comparison_operator        = "GREATER_THAN"
    threshold                  = 100
    threshold_type             = "PERCENTAGE"
    notification_type          = "FORECASTED"
    subscriber_email_addresses = ["[email protected]"]
  }
}

it is explained in the below link. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget

https://rafaelribeiro.io/blog/billings-alarms-aws-using-terraform