cloud-foundation-fabric/modules/billing-budget
Ludovico Magnocavallo 789328ff5a
Bump provider versions to v5.0.0 (#1724)
* bump provider versions to 5.0.0

* fix cloud run, logging and vpc-sc

* Fix secret manager

* fix gke nodepool

* fix gke multitenant stage and blueprint

* Moving alloydb module to experimental.

* Add project to bare resources in examples

* tfdoc

* fix svpc blueprint test

* Revert "fix svpc blueprint test"

This reverts commit 14f02659098070136e64ead600580dd52c23c339.

* Fix GKE peering project

* Disable tests in alloydb module

* Bring back secret ids in secret manager tests

* Remove duplicate key

* last push

---------

Co-authored-by: Julio Castillo <jccb@google.com>
2023-10-03 12:15:36 +00:00
..
README.md Ensure all modules have an `id` output (#1410) 2023-06-02 16:07:22 +02:00
main.tf Copyright bump (#410) 2022-01-01 15:52:31 +01:00
outputs.tf Ensure all modules have an `id` output (#1410) 2023-06-02 16:07:22 +02:00
variables.tf Add periods at the end of each description field where missing (#478) 2022-01-31 10:45:34 +01:00
versions.tf Bump provider versions to v5.0.0 (#1724) 2023-10-03 12:15:36 +00:00

README.md

Google Cloud Billing Budget Module

This module allows creating a Cloud Billing budget for a set of services and projects.

To create billing budgets you need one of the following IAM roles on the target billing account:

  • Billing Account Administrator
  • Billing Account Costs Manager

Examples

Simple email notification

Send a notification to an email when a set of projects reach $100 of spend.

module "budget" {
  source          = "./fabric/modules/billing-budget"
  billing_account = var.billing_account_id
  name            = "$100 budget"
  amount          = 100
  thresholds = {
    current    = [0.5, 0.75, 1.0]
    forecasted = [1.0]
  }
  projects = [
    "projects/123456789000",
    "projects/123456789111"
  ]
  email_recipients = {
    project_id = "my-project"
    emails     = ["user@example.com"]
  }
}
# tftest modules=1 resources=2 inventory=email.yaml

Pubsub notification

Send a notification to a PubSub topic the total spend of a billing account reaches the previous month's spend.

module "budget" {
  source          = "./fabric/modules/billing-budget"
  billing_account = var.billing_account_id
  name            = "previous period budget"
  amount          = 0
  thresholds = {
    current    = [1.0]
    forecasted = []
  }
  pubsub_topic = module.pubsub.id
}

module "pubsub" {
  source     = "./fabric/modules/pubsub"
  project_id = var.project_id
  name       = "budget-topic"
}

# tftest modules=2 resources=2 inventory=pubsub.yaml

Variables

name description type required default
billing_account Billing account id. string
name Budget name. string
thresholds Thresholds percentages at which alerts are sent. Must be a value between 0 and 1. object({…})
amount Amount in the billing account's currency for the budget. Use 0 to set budget to 100% of last period's spend. number 0
credit_treatment How credits should be treated when determining spend for threshold calculations. Only INCLUDE_ALL_CREDITS or EXCLUDE_ALL_CREDITS are supported. string "INCLUDE_ALL_CREDITS"
email_recipients Emails where budget notifications will be sent. Setting this will create a notification channel for each email in the specified project. object({…}) null
notification_channels Monitoring notification channels where to send updates. list(string) null
notify_default_recipients Notify Billing Account Administrators and Billing Account Users IAM roles for the target account. bool false
projects List of projects of the form projects/{project_number}, specifying that usage from only this set of projects should be included in the budget. Set to null to include all projects linked to the billing account. list(string) null
pubsub_topic The ID of the Cloud Pub/Sub topic where budget related messages will be published. string null
services List of services of the form services/{service_id}, specifying that usage from only this set of services should be included in the budget. Set to null to include usage for all services. list(string) null

Outputs

name description sensitive
budget Budget resource.
id Fully qualified budget id.