From f86823650c20706e01a3cc4754e27c4e782c7e1f Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 11 Jul 2024 15:13:37 +0200 Subject: [PATCH] terraform, gcp: rename budget resource as a workaround Apparently terraform fails to migrate a budget with a fixed number to a budget referencing the last month, but recreating the budget worked fine though. By renaming this resource we accomplished that. This is what was shown repeatedly after each terraform apply without forcing the re-creation: ``` Terraform will perform the following actions: # google_billing_budget.budget[0] will be updated in-place ~ resource "google_billing_budget" "budget" { id = "censored" name = "censored" # (3 unchanged attributes hidden) ~ amount { ~ last_period_amount = false -> true - specified_amount { - currency_code = "USD" -> null - nanos = 0 -> null # (1 unchanged attribute hidden) } } # (4 unchanged blocks hidden) } Plan: 0 to add, 1 to change, 0 to destroy. ```` --- terraform/gcp/budget-alerts.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/gcp/budget-alerts.tf b/terraform/gcp/budget-alerts.tf index 038fc71a23..b46a8cb3fa 100644 --- a/terraform/gcp/budget-alerts.tf +++ b/terraform/gcp/budget-alerts.tf @@ -18,7 +18,7 @@ resource "google_monitoring_notification_channel" "support_email" { # Need to explicitly enable https://console.cloud.google.com/apis/library/billingbudgets.googleapis.com?project=two-eye-two-see # resource ref: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/billing_budget -resource "google_billing_budget" "budget" { +resource "google_billing_budget" "budgets" { count = var.budget_alert_enabled ? 1 : 0 billing_account = var.billing_account_id