Skip to content

BigQuery v1 global connections cannot be updated — adapter_version in PATCH payload #685

@mariusostby

Description

@mariusostby

Describe the bug

dbtcloud_global_connection updates fail for BigQuery v1 connections because the provider sends adapter_version in PATCH requests, which the dbt Cloud API rejects as an invalid field.

The UpdateWithLatestAdapter() function in pkg/dbt_cloud/global_connection.go includes adapter_version in the payload:

// lines 204-218
func (c *GlobalConnectionClient[T]) UpdateWithLatestAdapter(...) {
    payload := globalConnectionPayload[T]{
        GlobalConnectionCommon: common,
        AccountID:              int64(c.AccountID),
        AdapterVersion:         &av,  // <-- Should not be sent on PATCH
        Config:                 config,
    }

The Update() function (lines 220-230) correctly omits this field and works fine. The issue is that BigQuery v1 connections route through UpdateWithLatestAdapter().

This makes BigQuery v1 global connections effectively immutable after creation — any in-place update fails.

Error message

Error: Unable to update global connection

"developer_message":"Invalid request data: adapter_version: extra fields not permitted"

Resource configuration

resource "dbtcloud_global_connection" "bigquery_wif" {
  name                   = "my-bigquery-connection"
  oauth_configuration_id = 341

  bigquery = {
    gcp_project_id              = "my-gcp-project"
    timeout_seconds             = 300
    private_key_id              = "placeholder"
    private_key                 = "placeholder"
    client_email                = "sa@my-gcp-project.iam.gserviceaccount.com"
    client_id                   = "123456789"
    auth_uri                    = "https://accounts.google.com/o/oauth2/auth"
    token_uri                   = "https://oauth2.googleapis.com/token"
    auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
    client_x509_cert_url        = "https://www.googleapis.com/robot/v1/metadata/x509/..."
  }
}

Changing any attribute (e.g., name, oauth_configuration_id, timeout_seconds) and running terraform apply triggers the error.

Expected behavior

The connection should update in-place, the same as other connection types that use the Update() code path.

Config

  • dbt Cloud provider version: v1.10.3 (also affects v1.9.1, v1.10.0)

Additional context

Workaround: The only current workaround is to destroy and recreate connections for any change. Adding lifecycle { ignore_changes = [...] } doesn't help because the update code path still sends the rejected field.

Suggested fix: Remove AdapterVersion: &av from UpdateWithLatestAdapter() to match the working Update() function:

payload := globalConnectionPayload[T]{
    GlobalConnectionCommon: common,
    AccountID:              int64(c.AccountID),
    // AdapterVersion omitted - API rejects it on PATCH
    Config:                 config,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions