-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add BigTable source format in BigQuery tables #4155
Changes from 2 commits
bf4a252
828eb0a
f503762
4e6bf18
0fdd96b
137dff6
d9a0a51
a1c8a93
05336e5
552aa0e
e992d4e
7c848b2
7eb6f1d
194aeb7
2973a68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -416,6 +416,30 @@ func TestAccBigQueryDataTable_sheet(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccBigQueryDataTable_bigtable(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should only be run for the An example can be seen here: https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/tests/resource_binaryauthorization_policy_test.go.erb#L41 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's quite a weird one actually: From the BigQuery API point of view, I don't think it requires the beta provider. |
||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": randString(t, 10), | ||
} | ||
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccBigQueryTableFromBigtable(context), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this doesn't match the function declaration, causing this error: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, thanks! |
||
}, | ||
{ | ||
ResourceName: "google_bigquery_table.table", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccCheckBigQueryExtData(t *testing.T, expectedQuoteChar string) resource.TestCheckFunc { | ||
return func(s *terraform.State) error { | ||
for _, rs := range s.RootModule().Resources { | ||
|
@@ -1048,6 +1072,37 @@ func testAccBigQueryTableFromSheet(context map[string]interface{}) string { | |
`, context) | ||
} | ||
|
||
func testAccBigQueryTableFromBigTable(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_bigquery_table" "table" { | ||
dataset_id = google_bigquery_dataset.dataset.dataset_id | ||
table_id = "tf_test_bigtable_%{random_suffix}" | ||
|
||
external_data_configuration { | ||
autodetect = true | ||
source_format = "BIGTABLE" | ||
ignore_unknown_values = true | ||
|
||
source_uris = [ | ||
"https://https://googleapis.com/bigtable/projects/project_id/instances/instance_id/tables/table_name", | ||
] | ||
} | ||
} | ||
|
||
resource "google_bigquery_dataset" "dataset" { | ||
dataset_id = "tf_test_ds_%{random_suffix}" | ||
friendly_name = "test" | ||
description = "This is a test description" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
} | ||
`, context) | ||
} | ||
|
||
var TEST_CSV = `lifelock,LifeLock,,web,Tempe,AZ,1-May-07,6850000,USD,b | ||
lifelock,LifeLock,,web,Tempe,AZ,1-Oct-06,6000000,USD,a | ||
lifelock,LifeLock,,web,Tempe,AZ,1-Jan-08,25000000,USD,c | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder
ORC
can also included in the source_format list ?. We have an open issue (hashicorp/terraform-provider-google#7691) for that type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, sorry but that's out of scope for this PR - adding it in the list is trivial but requires to write the tests.