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

Feature request: Budget notifications #4548

Closed
afeld opened this issue May 16, 2018 · 6 comments
Closed

Feature request: Budget notifications #4548

afeld opened this issue May 16, 2018 · 6 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/budgets Issues and PRs that pertain to the budgets service.
Milestone

Comments

@afeld
Copy link
Contributor

afeld commented May 16, 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'm using the new aws_budgets_budget resource, and am trying to set up notifications around it. This resource would support that use case.

I'm interested in implementing this, but would love feedback first.

New or Affected Resource(s)

  • aws_budgets_notification

Potential Terraform Configuration

data "aws_caller_identity" "current" {}

resource "aws_budgets_budget" "budget" {
  # ...
}

resource "aws_sns_topic" "team" {
  # ...
}

# OPTION 1

resource "aws_budgets_notification" "high_spending" {
  account_id = "${data.aws_caller_identity.current.account_id}"
  budget_name = "${aws_budgets_budget.budget.name}"

  notification_type = "ACTUAL"
  comparison_operator = "GREATER_THAN"
  threshold = "80"
  threshold_type = "PERCENTAGE"

  subscription_type = "SNS"
  subscription_address = "${aws_sns_topic.team.arn}"
}

# OPTION 2

resource "aws_budgets_notification" "high_spending" {
  account_id = "${data.aws_caller_identity.current.account_id}"
  budget_name = "${aws_budgets_budget.budget.name}"

  notification_type = "ACTUAL"
  comparison_operator = "GREATER_THAN"
  threshold = "80"
  threshold_type = "PERCENTAGE"

  subscription {
    type = "SNS"
    address = "${aws_sns_topic.team.arn}"
  }
}

Disclaimers

The subscription configuration needs to be included in the aws_budgets_notification resource configuration because they are (strangely) required when creating notifications, even though there are API actions to add and remove them.

Option 1 is presumably simpler to implement (in terms of parsing, state management, etc.), but Option 2 gives the option for supporting multiple subscription blocks.

The account ID is required when creating a notification through the API, but it's not an option in the Console. It's unclear when that would/could be a value other than the "effective account ID".

References

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/budgets Issues and PRs that pertain to the budgets service. labels May 18, 2018
@snemetz
Copy link

snemetz commented May 21, 2018

Please support both SNS and email notification options

Option 2 is better, as it matches what the underlying API can do.

@flosell
Copy link
Contributor

flosell commented Jul 1, 2018

I opened a PR (#4523) a while back that's not merged yet, maybe add a 👍 over there if you are interested in this feature

@goochi1
Copy link

goochi1 commented Mar 18, 2019

Was this ever added?

@bflad bflad added this to the v2.5.0 milestone Apr 1, 2019
@bflad
Copy link
Contributor

bflad commented Apr 1, 2019

Support for notification configuration blocks in the aws_budgets_budget resource has been merged and will release with version 2.5.0 of the Terraform AWS Provider, later this week. Thanks, @flosell!

@bflad bflad closed this as completed Apr 1, 2019
@midacts
Copy link

midacts commented Apr 18, 2019

Thanks for adding this functionality.
First time using this and noticed how recently this feature was added.

@ghost
Copy link

ghost commented Mar 30, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/budgets Issues and PRs that pertain to the budgets service.
Projects
None yet
Development

No branches or pull requests

6 participants