diff --git a/.changelog/9757.txt b/.changelog/9757.txt new file mode 100644 index 00000000000..5b6f907d55e --- /dev/null +++ b/.changelog/9757.txt @@ -0,0 +1,3 @@ +```release-note:bug +bigquery: Fix permadiff of encryption_configuration in resource_bigquery_table when API returns an empty object +``` diff --git a/google/services/bigquery/resource_bigquery_table.go b/google/services/bigquery/resource_bigquery_table.go index 970be34fb19..478873165da 100644 --- a/google/services/bigquery/resource_bigquery_table.go +++ b/google/services/bigquery/resource_bigquery_table.go @@ -2129,6 +2129,10 @@ func flattenEncryptionConfiguration(ec *bigquery.EncryptionConfiguration) []map[ re := regexp.MustCompile(`(projects/.*/locations/.*/keyRings/.*/cryptoKeys/.*)/cryptoKeyVersions/.*`) paths := re.FindStringSubmatch(ec.KmsKeyName) + if len(ec.KmsKeyName) == 0 { + return nil + } + if len(paths) > 0 { return []map[string]interface{}{ {