Skip to content

Conversation

@gorge511
Copy link
Contributor

@gorge511 gorge511 commented Nov 6, 2025

Hi, we noticed that almost any change in project settings or change on dependent module, like folder in which the project is created, triggers project number refresh via data resource and plan budget update because of that. The budget update is not performed, because at the apply phase the data resource returns identical project number.

  # module.my_project.module.budget.data.google_project.project[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "google_project" "project" {
  ...
      + project_id          = "my-project-1234"
  ...
    }

  # module.my_project.module.budget.google_billing_budget.budget[0] will be updated in-place
  ~ resource "google_billing_budget" "budget" {
  ...
      ~ budget_filter {
          ~ projects               = [
              - "projects/1234567890",
            ] -> (known after apply)
        }
    }

  # module.my_project.module.project-factory.google_service_account.default_service_account[0] will be created
  + resource "google_service_account" "default_service_account" {
      + account_id                   = "project-service-account"
      + create_ignore_already_exists = true
      + disabled                     = false
      + display_name                 = "my-project-1234 Project Service Account"
      + email                        = "[email protected]"
      + id                           = (known after apply)
      + member                       = "serviceAccount:[email protected]"
      + name                         = (known after apply)
      + project                      = "my-project-1234"
      + unique_id                    = (known after apply)
    }

Plan: 1 to add, 1 to change, 0 to destroy.

As the project number is immutable thing and it's known and already available in core_project_factory module outputs, I suggest passing it to the budget module directly to avoid using the data resource at all.

To keep the budget module backward compatible and still usable as standalone module, it will still fetch the project numbers when they are not provided directly.

@gorge511 gorge511 requested review from a team and imrannayer as code owners November 6, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant