From 36bfb953748806def8926151e1650bef7be17d11 Mon Sep 17 00:00:00 2001 From: Lucas Cicco Date: Tue, 16 Dec 2025 09:44:48 -0300 Subject: [PATCH] feat: add currency_code variable to budget module --- modules/budget/README.md | 1 + modules/budget/main.tf | 3 ++- modules/budget/metadata.display.yaml | 3 +++ modules/budget/metadata.yaml | 6 +++++- modules/budget/variables.tf | 6 ++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/budget/README.md b/modules/budget/README.md index 0b96a947..09073db8 100644 --- a/modules/budget/README.md +++ b/modules/budget/README.md @@ -28,6 +28,7 @@ module "project_myproject" { | calendar\_period | Specifies the calendar period for the budget. Possible values are MONTH, QUARTER, YEAR, CALENDAR\_PERIOD\_UNSPECIFIED, CUSTOM. custom\_period\_start\_date and custom\_period\_end\_date must be set if CUSTOM | `string` | `null` | no | | create\_budget | If the budget should be created | `bool` | `true` | no | | credit\_types\_treatment | Specifies how credits should be treated when determining spend for threshold calculations | `string` | `"INCLUDE_ALL_CREDITS"` | no | +| currency\_code | The currency code to use for the budget amount. If not specified, defaults to USD | `string` | `"USD"` | no | | custom\_period\_end\_date | Specifies the end date (DD-MM-YYYY) for the calendar\_period CUSTOM | `string` | `null` | no | | custom\_period\_start\_date | Specifies the start date (DD-MM-YYYY) for the calendar\_period CUSTOM | `string` | `null` | no | | display\_name | The display name of the budget. If not set defaults to `Budget For ` | `string` | `null` | no | diff --git a/modules/budget/main.tf b/modules/budget/main.tf index 13bde8d3..3f070466 100644 --- a/modules/budget/main.tf +++ b/modules/budget/main.tf @@ -70,7 +70,8 @@ resource "google_billing_budget" "budget" { amount { specified_amount { - units = tostring(var.amount) + units = tostring(var.amount) + currency_code = var.currency_code } } diff --git a/modules/budget/metadata.display.yaml b/modules/budget/metadata.display.yaml index 280940dd..03746fbc 100644 --- a/modules/budget/metadata.display.yaml +++ b/modules/budget/metadata.display.yaml @@ -52,6 +52,9 @@ spec: credit_types_treatment: name: credit_types_treatment title: Credit Types Treatment + currency_code: + name: currency_code + title: Currency Code custom_period_end_date: name: custom_period_end_date title: Custom Period End Date diff --git a/modules/budget/metadata.yaml b/modules/budget/metadata.yaml index c894d388..2efe0e2b 100644 --- a/modules/budget/metadata.yaml +++ b/modules/budget/metadata.yaml @@ -70,6 +70,10 @@ spec: description: The amount to use as the budget varType: number required: true + - name: currency_code + description: The currency code to use for the budget amount. If not specified, defaults to USD + varType: string + defaultValue: USD - name: create_budget description: If the budget should be created varType: bool @@ -145,4 +149,4 @@ spec: - serviceusage.googleapis.com providerVersions: - source: hashicorp/google - version: ">= 4.28, < 7" + version: ">= 4.28, < 8" diff --git a/modules/budget/variables.tf b/modules/budget/variables.tf index 75cb6fb3..7d48db84 100644 --- a/modules/budget/variables.tf +++ b/modules/budget/variables.tf @@ -29,6 +29,12 @@ variable "amount" { type = number } +variable "currency_code" { + description = "The currency code to use for the budget amount. If not specified, defaults to USD" + type = string + default = "USD" +} + variable "create_budget" { description = "If the budget should be created" type = bool