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

Feature request: Budget notifications #4548

Open
afeld opened this Issue May 16, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@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

@snemetz

This comment has been minimized.

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

This comment has been minimized.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment