Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform to manage GCP based billing alerts #2263

Closed
1 task
Tracked by #2431
consideRatio opened this issue Feb 27, 2023 · 2 comments
Closed
1 task
Tracked by #2431

Terraform to manage GCP based billing alerts #2263

consideRatio opened this issue Feb 27, 2023 · 2 comments

Comments

@consideRatio
Copy link
Member

It seems that we have created a billing alert in the two-eye-two-see GCP project manually, and that it is getting destroyed by terraform if we make changes to node pools in that project.

Due to that, we are probably required to add billing alerts via terraform and not via the managed cloud console.

Further since changes to node pools coupled to the manually added billing alert, we ran into permissions errors when using terraform that was very hard to understand but could be worked around as documented in #2261. I'm not sure if that PR should or shouldn't be accepted.

Action points

  • Figure out what to in more detail
@consideRatio
Copy link
Member Author

consideRatio commented Feb 27, 2023

We have now used terraform in the two-eye-two-see project's pilot-hubs cluster, and that destroyed the following resources.

  # google_billing_budget.budget[0] will be destroyed
  # (because google_billing_budget.budget is not in configuration)
  - resource "google_billing_budget" "budget" {
      - billing_account = "0157F7-E3EA8C-25AC3C" -> null
      - display_name    = "Billing alert" -> null
      - id              = "billingAccounts/0157F7-E3EA8C-25AC3C/budgets/1bf2106a-0b81-4a70-ab09-bcd568d80e13" -> null
      - name            = "1bf2106a-0b81-4a70-ab09-bcd568d80e13" -> null

      - all_updates_rule {
          - disable_default_iam_recipients   = true -> null
          - monitoring_notification_channels = [
              - "projects/two-eye-two-see/notificationChannels/10693994760737431897",
            ] -> null
          - schema_version                   = "1.0" -> null
        }

      - amount {
          - last_period_amount = false -> null

          - specified_amount {
              - currency_code = "USD" -> null
              - nanos         = 0 -> null
              - units         = "2500" -> null
            }
        }

      - budget_filter {
          - calendar_period        = "MONTH" -> null
          - credit_types           = [] -> null
          - credit_types_treatment = "INCLUDE_ALL_CREDITS" -> null
          - labels                 = {} -> null
          - projects               = [
              - "projects/350668521154",
            ] -> null
          - services               = [] -> null
          - subaccounts            = [] -> null
        }

      - threshold_rules {
          - spend_basis       = "CURRENT_SPEND" -> null
          - threshold_percent = 1 -> null
        }
      - threshold_rules {
          - spend_basis       = "FORECASTED_SPEND" -> null
          - threshold_percent = 1.01 -> null
        }
    }
    
  # google_monitoring_notification_channel.support_email[0] will be destroyed
  # (because google_monitoring_notification_channel.support_email is not in configuration)
  - resource "google_monitoring_notification_channel" "support_email" {
      - display_name = "support@2i2c.org email" -> null
      - enabled      = true -> null
      - force_delete = false -> null
      - id           = "projects/two-eye-two-see/notificationChannels/10693994760737431897" -> null
      - labels       = {
          - "email_address" = "support@2i2c.org"
        } -> null
      - name         = "projects/two-eye-two-see/notificationChannels/10693994760737431897" -> null
      - project      = "two-eye-two-see" -> null
      - type         = "email" -> null
      - user_labels  = {} -> null
    }

@consideRatio
Copy link
Member Author

I think this is outdated now with some terraform logic about it in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Needs Shaping / Refinement
Development

No branches or pull requests

1 participant