https://github.com/jameswoolfenden/terraform-aws-budget
Creates budgets for AWS Usage
https://github.com/jameswoolfenden/terraform-aws-budget
aws budget module terraform
Last synced: 12 months ago
JSON representation
Creates budgets for AWS Usage
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-budget
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2019-01-14T21:46:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-29T20:06:23.000Z (almost 3 years ago)
- Last Synced: 2025-06-14T16:47:48.614Z (about 1 year ago)
- Topics: aws, budget, module, terraform
- Language: HCL
- Homepage:
- Size: 130 KB
- Stars: 6
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-aws-budget
[](https://github.com/JamesWoolfenden/terraform-aws-budget)
[](https://github.com/JamesWoolfenden/terraform-aws-budget/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-budget/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-budget&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-budget&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module - creates a Budget and a Budget for half as much.
---
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
## Usage
These are just basic examples, your budget rules should be much more sophisticated.
Include this repository as a module in your existing terraform code:
```terraform
module "budget" {
source = "JamesWoolfenden/budget/aws"
version = "0.3.32"
limit = var.limit
time_period_start = var.time_period_start
budget = var.budget
notification = var.notification
}
```
The module reference uses 2 objects, budget and notification, from the example data. This module implements billing alerts on your AWS account,
the provided variables are in **examplea.auto.tfvars**:
```HCL
budget={
name = "budget-ec2-monthly"
budget_type = "COST"
time_unit = "MONTHLY"
limit_unit = "Pounds"
}
notification={
comparison_operator = "GREATER_THAN"
threshold = 100
threshold_type = "PERCENTAGE"
notification_type = "FORECASTED"
subscriber_email_addresses = ["test@example.com"]
subscriber_sns_topic_arns = [""]
}
```
The variable limit creates 2 sets of alerts one at its setting and another at half.
Additional users or groups can added to _subscriber_email_addresses_.
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_budgets_budget.budget](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [budget](#input\_budget) | Basic Budget Properties | `map(any)` |
{
"budget_type": "COST",
"limit_unit": "USD",
"name": "budget-ec2-monthly",
"time_unit": "MONTHLY"
} | no |
| [cost\_filters](#input\_cost\_filters) | The Budget filters to use | list(object({
name = string
values = set(string)
})) | `[]` | no |
| [half\_budget\_enabled](#input\_half\_budget\_enabled) | Whether to enable or disable the half budget alert | `bool` | `true` | no |
| [limit](#input\_limit) | Budget alarm limit | `number` | n/a | yes |
| [notification](#input\_notification) | Budget notification properties | object({
comparison_operator = string
threshold = number
threshold_type = string
notification_type = string
subscriber_email_addresses = set(any)
subscriber_sns_topic_arns = set(any)
}) | n/a | yes |
| [time\_period\_start](#input\_time\_period\_start) | Time to start | `string` | n/a | yes |
## Outputs
| Name | Description |
|------|-------------|
| [budget](#output\_budget) | n/a |
| [half\_budget](#output\_half\_budget) | n/a |
## Policy
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"budgets:ModifyBudget",
"budgets:ViewBudget"
],
"Resource": "*"
}
]
})
}
```
## Related Projects
Check out these related projects.
- [terraform-aws-s3](https://github.com/jameswoolfenden/terraform-aws-s3) - S3 buckets
## Help
**Got a question?**
File a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-budget/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-budget/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2019-2022 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150