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.
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}"
}
}
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".
Please support both SNS and email notification options
Option 2 is better, as it matches what the underlying API can do.
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
Was this ever added?
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!
Thanks for adding this functionality.
First time using this and noticed how recently this feature was added.
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!
Most helpful comment
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