Skip to content

Commit 0dabb82

Browse files
Set bigquery connection import id correctly. (#4159)
1 parent 9ec557d commit 0dabb82

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

products/bigqueryconnection/api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ objects:
2828
- !ruby/object:Api::Resource
2929
name: 'Connection'
3030
base_url: projects/{{project}}/locations/{{location}}/connections
31-
self_link: "{{name}}"
31+
self_link: projects/{{project}}/locations/{{location}}/connections/{{connection_id}}
3232
create_url: projects/{{project}}/locations/{{location}}/connections?connectionId={{connection_id}}
3333
update_verb: :PATCH
3434
update_mask: true

products/bigqueryconnection/terraform.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
2020
custom_flatten: 'templates/terraform/custom_flatten/bigquery_connection_flatten.go.erb'
2121
cloudSql.credential.password: !ruby/object:Overrides::Terraform::PropertyOverride
2222
sensitive: true
23-
id_format: "{{name}}"
24-
import_format: ["{{name}}"]
23+
id_format: "projects/{{project}}/locations/{{location}}/connections/{{connection_id}}"
24+
import_format: ["projects/{{project}}/locations/{{location}}/connections/{{connection_id}}", "{{project}}/{{location}}/{{connection_id}}", "{{location}}/{{connection_id}}"]
2525
examples:
2626
- !ruby/object:Provider::Terraform::Examples
2727
min_version: beta

third_party/terraform/tests/resource_bigquery_connection_test.go.erb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@ func TestAccBigqueryConnectionConnection_bigqueryConnectionBasic(t *testing.T) {
2828
{
2929
Config: testAccBigqueryConnectionConnection_bigqueryConnectionBasic(context),
3030
},
31+
{
32+
ImportState: true,
33+
ImportStateVerify: true,
34+
ImportStateVerifyIgnore: []string{"cloud_sql.0.credential.0.password", "cloud_sql.0.credential.0.username"},
35+
ResourceName: "google_bigquery_connection.connection",
36+
},
3137
{
3238
Config: testAccBigqueryConnectionConnection_bigqueryConnectionBasicUpdate(context),
3339
},
40+
{
41+
ImportState: true,
42+
ImportStateVerify: true,
43+
ImportStateVerifyIgnore: []string{"cloud_sql.0.credential.0.password", "cloud_sql.0.credential.0.username"},
44+
ResourceName: "google_bigquery_connection.connection",
45+
},
3446
},
3547
})
3648
}

0 commit comments

Comments
 (0)