Skip to content

Commit

Permalink
terraform, gcp: rename budget resource as a workaround
Browse files Browse the repository at this point in the history
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.
````
  • Loading branch information
consideRatio committed Jul 11, 2024
1 parent bc1f9e1 commit f868236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion terraform/gcp/budget-alerts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f868236

Please sign in to comment.