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

AWS Budget Actions #19541

Closed
dcloud9 opened this issue May 26, 2021 · 2 comments · Fixed by #19554
Closed

AWS Budget Actions #19541

dcloud9 opened this issue May 26, 2021 · 2 comments · Fixed by #19554
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. service/budgets Issues and PRs that pertain to the budgets service.
Milestone

Comments

@dcloud9
Copy link

dcloud9 commented May 26, 2021

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 other comments that do not add relevant new information or questions, 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

We have a use case where we need to set a budget for an AWS account, member or Organizations Unit (OU), and when it hits the upper limit/threshold set, it'll notify (this feature exist) and apply SCP (policy) to that account.
This would prevent the users further launching resources, Deny policy action.
Seems the API is already available for budget action, but not yet available in Terraform AWS provider v.3.42.0.
However, seems we can only apply the SCP to OU level.
Would be great to apply on AWS account level as well.

New or Affected Resource(s)

  • aws_budgets_budget

Potential Terraform Configuration

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_filters = {
    Service = "Amazon Elastic Compute Cloud - Compute"
  }

  notification {
    comparison_operator        = "GREATER_THAN"
    threshold                  = 100
    threshold_type             = "PERCENTAGE"
    notification_type          = "FORECASTED"
    subscriber_email_addresses = ["test@example.com"]
  }

  budget_action {
    action_type = "APPLY_SCP_POLICY"
    approval_model = "AUTOMATIC"
    ou_ids = ["ou-dev", "ou-prod"]
  }
}

References

https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Action.html
https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_ScpActionDefinition.html

  • #0000
@dcloud9 dcloud9 added the enhancement Requests to existing resources that expand the functionality or scope. label May 26, 2021
@ghost ghost added the service/budgets Issues and PRs that pertain to the budgets service. label May 26, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 26, 2021
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label May 27, 2021
@DrFaust92 DrFaust92 added the new-resource Introduces a new resource. label May 27, 2021
@github-actions github-actions bot added this to the v3.46.0 milestone Jun 14, 2021
@github-actions
Copy link

This functionality has been released in v3.46.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
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. new-resource Introduces a new resource. service/budgets Issues and PRs that pertain to the budgets service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants