Skip to content

Conversation

@charlie-costanzo
Copy link
Member

Description

While investigating unexpected behavior in the create_row_access_policy dbt macro, we discovered a previously-used but potentially no-longer-needed service account (bq-transform-svcacct) responsible for granting Airflow pod operators access to GCS and bigquery was still in place.

Upon performing an investigation into this service account's usage metrics, it appears as this service account is no longer used and safe to remove.

Resolves #4478

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

How has this been tested?

Bigquery service account usage data metrics in GCP console, filtered for the past two years (12/5/23-12/5/25)
Screenshot 2025-12-05 at 14 07 55

Post-merge follow-ups

  • No action required

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Terraform plan in iac/cal-itp-data-infra/composer/us

Plan: 0 to add, 1 to change, 0 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~  update in-place

Terraform will perform the following actions:

  # google_composer_environment.calitp-composer will be updated in-place
!~  resource "google_composer_environment" "calitp-composer" {
        id               = "projects/cal-itp-data-infra/locations/us-west2/environments/calitp-composer"
        name             = "calitp-composer"
#        (5 unchanged attributes hidden)

!~      config {
#            (8 unchanged attributes hidden)

!~          software_config {
!~              env_variables            = {
!~                  "CALITP_SLACK_URL"                                     = (sensitive value)
#                    (57 unchanged elements hidden)
                }
#                (6 unchanged attributes hidden)

#                (1 unchanged block hidden)
            }

#            (8 unchanged blocks hidden)
        }

#        (1 unchanged block hidden)
    }

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

📝 Plan generated in Plan Terraform for Warehouse and DAG changes #1136

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Terraform plan in iac/cal-itp-data-infra-staging/airflow/us

Plan: 0 to add, 1 to change, 0 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~  update in-place

Terraform will perform the following actions:

  # google_storage_bucket_object.calitp-staging-composer-dags["macros/create_row_access_policy.sql"] will be updated in-place
!~  resource "google_storage_bucket_object" "calitp-staging-composer-dags" {
!~      crc32c              = "a0fXqQ==" -> (known after apply)
!~      detect_md5hash      = "QmMH9YNTObKzJyk+UuM32A==" -> "different hash"
!~      generation          = 1762539327276751 -> (known after apply)
        id                  = "calitp-staging-composer-data/warehouse/macros/create_row_access_policy.sql"
!~      md5hash             = "QmMH9YNTObKzJyk+UuM32A==" -> (known after apply)
        name                = "data/warehouse/macros/create_row_access_policy.sql"
#        (17 unchanged attributes hidden)
    }

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

📝 Plan generated in Plan Terraform for Warehouse and DAG changes #1136

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Terraform plan in iac/cal-itp-data-infra/airflow/us

Plan: 0 to add, 3 to change, 0 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~  update in-place

Terraform will perform the following actions:

  # google_storage_bucket_object.calitp-composer-catalog will be updated in-place
!~  resource "google_storage_bucket_object" "calitp-composer-catalog" {
!~      content             = (sensitive value)
!~      crc32c              = "XcMgKw==" -> (known after apply)
!~      detect_md5hash      = "cs6J44w9KE5zKtiq4EYrQw==" -> "different hash"
!~      generation          = 1764958906586741 -> (known after apply)
        id                  = "calitp-composer-data/warehouse/target/catalog.json"
!~      md5hash             = "cs6J44w9KE5zKtiq4EYrQw==" -> (known after apply)
        name                = "data/warehouse/target/catalog.json"
#        (16 unchanged attributes hidden)
    }

  # google_storage_bucket_object.calitp-composer-dags["macros/create_row_access_policy.sql"] will be updated in-place
!~  resource "google_storage_bucket_object" "calitp-composer-dags" {
!~      crc32c              = "a0fXqQ==" -> (known after apply)
!~      detect_md5hash      = "QmMH9YNTObKzJyk+UuM32A==" -> "different hash"
!~      generation          = 1762479890466072 -> (known after apply)
        id                  = "calitp-composer-data/warehouse/macros/create_row_access_policy.sql"
!~      md5hash             = "QmMH9YNTObKzJyk+UuM32A==" -> (known after apply)
        name                = "data/warehouse/macros/create_row_access_policy.sql"
#        (17 unchanged attributes hidden)
    }

  # google_storage_bucket_object.calitp-composer-manifest will be updated in-place
!~  resource "google_storage_bucket_object" "calitp-composer-manifest" {
!~      content             = (sensitive value)
!~      crc32c              = "eQEchg==" -> (known after apply)
!~      detect_md5hash      = "ji0wGARPZVfr4tAxZDKDnw==" -> "different hash"
!~      generation          = 1764958908070109 -> (known after apply)
        id                  = "calitp-composer-data/warehouse/target/manifest.json"
!~      md5hash             = "ji0wGARPZVfr4tAxZDKDnw==" -> (known after apply)
        name                = "data/warehouse/target/manifest.json"
#        (16 unchanged attributes hidden)
    }

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

📝 Plan generated in Plan Terraform for Warehouse and DAG changes #1136

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Terraform plan in iac/cal-itp-data-infra-staging/iam/us

Plan: 0 to add, 0 to change, 7 to destroy. Changes to Outputs.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-   destroy

Terraform will perform the following actions:

  # google_project_iam_member.tfer--roles-002F-bigquery-002E-dataEditorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-bigquery-002E-dataEditorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-bigquery-002E-dataEditorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/bigquery.dataEditorserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/bigquery.dataEditor" -> null
    }

  # google_project_iam_member.tfer--roles-002F-bigquery-002E-jobUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-bigquery-002E-jobUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-bigquery-002E-jobUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/bigquery.jobUserserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/bigquery.jobUser" -> null
    }

  # google_project_iam_member.tfer--roles-002F-bigquery-002E-userserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-bigquery-002E-userserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-bigquery-002E-userserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/bigquery.userserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/bigquery.user" -> null
    }

  # google_project_iam_member.tfer--roles-002F-dataproc-002E-editorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-dataproc-002E-editorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-dataproc-002E-editorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/dataproc.editorserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/dataproc.editor" -> null
    }

  # google_project_iam_member.tfer--roles-002F-dataproc-002E-workerserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-dataproc-002E-workerserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-dataproc-002E-workerserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/dataproc.workerserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/dataproc.worker" -> null
    }

  # google_project_iam_member.tfer--roles-002F-iam-002E-serviceAccountUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-iam-002E-serviceAccountUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-iam-002E-serviceAccountUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/iam.serviceAccountUserserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/iam.serviceAccountUser" -> null
    }

  # google_project_iam_member.tfer--roles-002F-storage-002E-objectAdminserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com will be destroyed
  # (because google_project_iam_member.tfer--roles-002F-storage-002E-objectAdminserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com is not in configuration)
-   resource "google_project_iam_member" "tfer--roles-002F-storage-002E-objectAdminserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com" {
-       etag    = "BwZEYSZOoyw=" -> null
-       id      = "roles/storage.objectAdminserviceAccount:[email protected]" -> null
-       member  = "serviceAccount:[email protected]" -> null
-       project = "cal-itp-data-infra-staging" -> null
-       role    = "roles/storage.objectAdmin" -> null
    }

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

Changes to Outputs:
-   google_project_iam_member_tfer--roles-002F-bigquery-002E-dataEditorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                        = "roles/bigquery.dataEditorserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-bigquery-002E-jobUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                           = "roles/bigquery.jobUserserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-bigquery-002E-userserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                              = "roles/bigquery.userserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-dataproc-002E-editorserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                            = "roles/dataproc.editorserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-dataproc-002E-workerserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                            = "roles/dataproc.workerserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-iam-002E-serviceAccountUserserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                     = "roles/iam.serviceAccountUserserviceAccount:[email protected]" -> null
-   google_project_iam_member_tfer--roles-002F-storage-002E-objectAdminserviceAccount-003A-bq-transform-svcacct-0040-cal-itp-data-infra-002E-iam-002E-gserviceaccount-002E-com_id                        = "roles/storage.objectAdminserviceAccount:[email protected]" -> null

📝 Plan generated in Terraform Plan #693

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Warehouse report 📦

DAG

Legend (in order of precedence)

Resource type Indicator Resolution
Large table-materialized model Orange Make the model incremental
Large model without partitioning or clustering Orange Add partitioning and/or clustering
View with more than one child Yellow Materialize as a table or incremental
Incremental Light green
Table Green
View White

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin Administrative tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate deprecating service account bq-transform-svcacct

2 participants