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

send friendly_name #13973

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/7433.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
bigquery: fixed a permadiff when `friendly_name` is removed from `google_bigquery_dataset`
```
26 changes: 26 additions & 0 deletions google/resource_big_query_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func TestAccBigQueryDataset_basic(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccBigQueryDatasetUpdated2(datasetID),
},
{
ResourceName: "google_bigquery_dataset.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down Expand Up @@ -212,6 +220,24 @@ resource "google_bigquery_dataset" "test" {
`, datasetID)
}

func testAccBigQueryDatasetUpdated2(datasetID string) string {
return fmt.Sprintf(`
resource "google_bigquery_dataset" "test" {
dataset_id = "%s"
# friendly_name = "bar"
description = "This is a bar description"
location = "EU"
default_partition_expiration_ms = 7200000
default_table_expiration_ms = 7200000

labels = {
env = "bar"
default_table_expiration_ms = 7200000
}
}
`, datasetID)
}

func testAccBigQueryDatasetDeleteContents(datasetID string) string {
return fmt.Sprintf(`
resource "google_bigquery_dataset" "contents_test" {
Expand Down
4 changes: 2 additions & 2 deletions google/resource_bigquery_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func resourceBigQueryDatasetCreate(d *schema.ResourceData, meta interface{}) err
friendlyNameProp, err := expandBigQueryDatasetFriendlyName(d.Get("friendly_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("friendly_name"); !isEmptyValue(reflect.ValueOf(friendlyNameProp)) && (ok || !reflect.DeepEqual(v, friendlyNameProp)) {
} else if v, ok := d.GetOkExists("friendly_name"); ok || !reflect.DeepEqual(v, friendlyNameProp) {
obj["friendlyName"] = friendlyNameProp
}
labelsProp, err := expandBigQueryDatasetLabels(d.Get("labels"), d, config)
Expand Down Expand Up @@ -635,7 +635,7 @@ func resourceBigQueryDatasetUpdate(d *schema.ResourceData, meta interface{}) err
friendlyNameProp, err := expandBigQueryDatasetFriendlyName(d.Get("friendly_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("friendly_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, friendlyNameProp)) {
} else if v, ok := d.GetOkExists("friendly_name"); ok || !reflect.DeepEqual(v, friendlyNameProp) {
obj["friendlyName"] = friendlyNameProp
}
labelsProp, err := expandBigQueryDatasetLabels(d.Get("labels"), d, config)
Expand Down