...
1/**
2 * Copyright 2022 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17```hcl
18data "google_billing_account" "account" {
19 billing_account = "000000-0000000-0000000-000000"
20}
21
22data "google_project" "project" {
23}
24
25resource "google_billing_budget" "budget" {
26 billing_account = data.google_billing_account.account.id
27 display_name = "Example Billing Budget"
28
29 budget_filter {
30 projects = ["projects/${data.google_project.project.number}"]
31 credit_types_treatment = "EXCLUDE_ALL_CREDITS"
32 services = ["services/24E6-581D-38E5"] # Bigquery
33
34 custom_period {
35 start_date {
36 year = 2022
37 month = 1
38 day = 1
39 }
40 end_date {
41 year = 2023
42 month = 12
43 day = 31
44 }
45 }
46 }
47
48 amount {
49 specified_amount {
50 currency_code = "USD"
51 units = "100000"
52 }
53 }
54
55 threshold_rules {
56 threshold_percent = 0.5
57 }
58 threshold_rules {
59 threshold_percent = 0.9
60 }
61}
62```
View as plain text