-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add BigLake API Table Resource #8754
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
Merged
melinath
merged 63 commits into
GoogleCloudPlatform:main
from
nevzheng:add-biglake-table
Sep 6, 2023
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
b6760ea
Add BigLake Table Resource
nevzheng ab464a9
add: biglake table example
nevzheng 3e4c7b1
add: biglake table update test
nevzheng 2b02fb3
update: hive_options
nevzheng c4943b3
fix: wrong directory
nevzheng 307f743
trim: trailing whitespace
nevzheng 9b729ae
fix: incorrect example location
nevzheng 286835f
delete: incorrect file
nevzheng 24e0d26
add: acc tests for biglake table
nevzheng c4df7f9
Add SDK provider configuration tests, part 2 (#7723)
SarahFrench 8caf6bf
TeamCity: Usability improvements : tag builds to distinguish nightly …
SarahFrench 9604694
Add ignore read on reservedIpRange field Filestore Instance (#8520)
bsteinberg 456e714
b-283271112 Add "additionalScopes" under webSsoConfig for the "groups…
vaibhav-google 264f93f
Made breaking change detector own its own setup and build process (#8…
melinath f6b396b
Go changelog (#8727)
trodge 5f2c515
Fix acctest import specifying the beta version instead of GA (#8736)
roaks3 ec7e816
Cleanup deprecated folders (#8720)
zli82016 8fa5827
Remove test lines from changelog checker (#8763)
ScottSuarez ef6b18e
Adds the synthetic monitor target type as an option for uptime checks…
dkoss a8982ad
Removed guard around operation WithResponse method & improved error h…
melinath fd06323
Add zli82016 to the vacation list (#8761)
zli82016 425cb45
Update example for google_compute_addresses data source (#8765)
alzabo fb415b9
Remove myself from vacation list (#8770)
rileykarson 771116e
Document database flags type change (#8769)
smcgivern adeed2d
Added some missing what's next links (#8733)
melinath 37c7843
Add: BigLake API Catalog Resource (#8751)
nevzheng d7154ba
Add workflow for membership checker unit tests (#8760)
trodge 6cfe99b
Key upload (#8714)
bohengy 9b944df
Marks `template.volumes.secret.items.mode` field not required in Clou…
yanweiguo d41ff15
Removed MembershipRBACRoleBinding from ga provider (#8776)
ScottSuarez 2e5f8a5
make distribution_policy_target_shape updatable (#8774)
edwardmedia 708d17e
feat(google_container_cluster): support fqdn network policy (#8461)
toVersus 0db8c76
Redis cluster terraform support (#8567)
himanikh c0ce53f
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng 35852e5
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng ba2e974
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng 906ce7c
move: Table.yaml to `biglake`
nevzheng 47f71d1
update: switch to parent id convention
nevzheng 87c4790
update: example to use parent id convention
nevzheng f9c2472
update: continue to update to parent convention
nevzheng 46f67c0
add: biglake table custom import
nevzheng 7f03e78
fix: correct usage of names
nevzheng 510aae0
fix: extra comma
nevzheng 1149968
fix: parameter spec.
nevzheng 6d4815e
fix: parameters spec
nevzheng e397296
delete: remove location param
nevzheng 6d512c7
fix: build
nevzheng 48e50bb
fix: correct url
nevzheng 57417c3
add: spec custom import
nevzheng 4b83da6
Merge branch 'main' of github.com:GoogleCloudPlatform/magic-modules i…
nevzheng f8ece65
update: switch to id_format over custom import
nevzheng c525b91
fix: remove location from resource test.
nevzheng dc61fdb
fix: test names
nevzheng 0ddc8ce
add: serde_info to acc test
nevzheng 5b7154d
fix: serde_info is a struct
nevzheng d85b010
remove: serde_info due to api bug.
nevzheng f28d473
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng 64db563
delete: unsupported serdeinfo field
nevzheng 7e573da
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng 850d040
fix: use example person names
nevzheng e0f5188
update: mark `database` immutable
nevzheng 60adec6
update: change more fields in update test
nevzheng 44fb0aa
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # Copyright 2023 Google Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| --- | ||
| !ruby/object:Api::Resource | ||
| name: "Table" | ||
| description: | | ||
| Represents a table. | ||
| references: !ruby/object:Api::Resource::ReferenceLinks | ||
| guides: | ||
| "Manage open source metadata with BigLake Metastore": "https://cloud.google.com/bigquery/docs/manage-open-source-metadata#create_tables" | ||
| api: "https://cloud.google.com/bigquery/docs/reference/biglake/rest/v1/projects.locations.catalogs.databases.tables" | ||
| base_url: "{{database}}/tables" | ||
| self_link: "{{database}}/tables/{{name}}" | ||
| create_url: "{{database}}/tables?tableId={{name}}" | ||
| id_format: "{{database}}/tables/{{name}}" | ||
| import_format: ["{{%database}}/tables/{{name}}"] | ||
| update_verb: :PATCH | ||
| update_mask: true | ||
| examples: | ||
| - !ruby/object:Provider::Terraform::Examples | ||
| name: "biglake_table" | ||
| primary_resource_id: "table" | ||
| vars: | ||
| name: "my_table" | ||
| catalog: "my_catalog" | ||
| database: "my_database" | ||
| bucket: "my_bucket" | ||
|
|
||
| parameters: | ||
| - !ruby/object:Api::Type::String | ||
| name: "name" | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| description: | | ||
| Output only. The name of the Table. Format: | ||
| projects/{project_id_or_number}/locations/{locationId}/catalogs/{catalogId}/databases/{databaseId}/tables/{tableId} | ||
| - !ruby/object:Api::Type::String | ||
| name: "database" | ||
| immutable: true | ||
| url_param_only: true | ||
| description: | | ||
| The id of the parent database. | ||
| properties: | ||
| - !ruby/object:Api::Type::String | ||
| name: "createTime" | ||
| description: | | ||
| Output only. The creation time of the table. A timestamp in RFC3339 UTC | ||
| "Zulu" format, with nanosecond resolution and up to nine fractional | ||
| digits. Examples: "2014-10-02T15:01:23Z" and | ||
| "2014-10-02T15:01:23.045123456Z". | ||
| output: true | ||
| - !ruby/object:Api::Type::String | ||
| name: "updateTime" | ||
| description: | | ||
| Output only. The last modification time of the table. A timestamp in | ||
| RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine | ||
| fractional digits. Examples: "2014-10-02T15:01:23Z" and | ||
| "2014-10-02T15:01:23.045123456Z". | ||
| output: true | ||
| - !ruby/object:Api::Type::String | ||
| name: "deleteTime" | ||
| description: | | ||
| Output only. The deletion time of the table. Only set after the | ||
| table is deleted. A timestamp in RFC3339 UTC "Zulu" format, with | ||
| nanosecond resolution and up to nine fractional digits. Examples: | ||
| "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". | ||
| output: true | ||
| - !ruby/object:Api::Type::String | ||
| name: "expireTime" | ||
| description: | | ||
| Output only. The time when this table is considered expired. Only set | ||
| after the table is deleted. A timestamp in RFC3339 UTC "Zulu" format, | ||
| with nanosecond resolution and up to nine fractional digits. Examples: | ||
| "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". | ||
| output: true | ||
| - !ruby/object:Api::Type::String | ||
| name: "etag" | ||
| description: | | ||
| The checksum of a table object computed by the server based on the value | ||
| of other fields. It may be sent on update requests to ensure the client | ||
| has an up-to-date value before proceeding. It is only checked for update | ||
| table operations. | ||
| output: true | ||
|
|
||
| - !ruby/object:Api::Type::Enum | ||
| name: "type" | ||
| description: | | ||
| The database type. | ||
| values: | ||
| - :HIVE | ||
| - !ruby/object:Api::Type::NestedObject | ||
| name: "hiveOptions" | ||
| description: | | ||
| Options of a Hive table. | ||
| properties: | ||
| - !ruby/object:Api::Type::KeyValuePairs | ||
| name: "parameters" | ||
| description: | | ||
| Stores user supplied Hive table parameters. An object containing a | ||
| list of "key": value pairs. | ||
| Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. | ||
| - !ruby/object:Api::Type::String | ||
| name: "tableType" | ||
| description: | | ||
| Hive table type. For example, MANAGED_TABLE, EXTERNAL_TABLE. | ||
| - !ruby/object:Api::Type::NestedObject | ||
| name: "storageDescriptor" | ||
| description: | | ||
| Stores physical storage information on the data. | ||
| properties: | ||
| - !ruby/object:Api::Type::String | ||
| name: "locationUri" | ||
| description: | | ||
| Cloud Storage folder URI where the table data is stored, starting with "gs://". | ||
| - !ruby/object:Api::Type::String | ||
| name: "inputFormat" | ||
| description: | | ||
| The fully qualified Java class name of the input format. | ||
| - !ruby/object:Api::Type::String | ||
| name: "outputFormat" | ||
| description: | | ||
| The fully qualified Java class name of the output format. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| resource "google_biglake_catalog" "catalog" { | ||
| name = "<%= ctx[:vars]['catalog'] %>" | ||
| location = "US" | ||
| } | ||
|
|
||
| resource "google_storage_bucket" "bucket" { | ||
| name = "<%= ctx[:vars]['bucket'] %>" | ||
| location = "US" | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
|
|
||
| resource "google_storage_bucket_object" "metadata_folder" { | ||
| name = "metadata/" | ||
| content = " " | ||
| bucket = google_storage_bucket.bucket.name | ||
| } | ||
|
|
||
|
|
||
| resource "google_storage_bucket_object" "data_folder" { | ||
| name = "data/" | ||
| content = " " | ||
| bucket = google_storage_bucket.bucket.name | ||
| } | ||
|
|
||
| resource "google_biglake_database" "database" { | ||
| name = "<%= ctx[:vars]['database'] %>" | ||
| catalog = google_biglake_catalog.catalog.id | ||
| type = "HIVE" | ||
| hive_options { | ||
| location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.metadata_folder.name}" | ||
| parameters = { | ||
| "owner" = "Alex" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| resource "google_biglake_table" "<%= ctx[:primary_resource_id] %>" { | ||
| name = "<%= ctx[:vars]['name'] %>" | ||
| database = google_biglake_database.database.id | ||
| type = "HIVE" | ||
| hive_options { | ||
| table_type = "MANAGED_TABLE" | ||
| storage_descriptor { | ||
| location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.data_folder.name}" | ||
| input_format = "org.apache.hadoop.mapred.SequenceFileInputFormat" | ||
| output_format = "org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat" | ||
| } | ||
| # Some Example Parameters. | ||
| parameters = { | ||
| "spark.sql.create.version" = "3.1.3" | ||
| "spark.sql.sources.schema.numParts" = "1" | ||
| "transient_lastDdlTime" = "1680894197" | ||
| "spark.sql.partitionProvider" = "catalog" | ||
| "owner" = "John Doe" | ||
|
nevzheng marked this conversation as resolved.
|
||
| "spark.sql.sources.schema.part.0"= "{\"type\":\"struct\",\"fields\":[{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}" | ||
| "spark.sql.sources.provider" = "iceberg" | ||
| "provider" = "iceberg" | ||
| } | ||
| } | ||
| } | ||
106 changes: 106 additions & 0 deletions
106
mmv1/third_party/terraform/services/biglake/resource_biglake_table_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| package biglake_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
|
||
| "github.com/hashicorp/terraform-provider-google/google/acctest" | ||
| ) | ||
|
|
||
| func TestAccBiglakeTable_biglakeTable_update(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| context := map[string]interface{}{ | ||
| "random_suffix": acctest.RandString(t, 10), | ||
| } | ||
|
|
||
| acctest.VcrTest(t, resource.TestCase{ | ||
| PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
| ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
| CheckDestroy: testAccCheckBiglakeTableDestroyProducer(t), | ||
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: testAccBiglakeTable_biglakeTableExample(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_biglake_table.table", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"name", "database"}, | ||
| }, | ||
| { | ||
| Config: testAccBiglakeTable_biglakeTable_update(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_biglake_table.table", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"name", "database"}, | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func testAccBiglakeTable_biglakeTable_update(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_biglake_catalog" "catalog" { | ||
| name = "tf_test_my_catalog%{random_suffix}" | ||
| location = "US" | ||
| } | ||
| resource "google_storage_bucket" "bucket" { | ||
| name = "tf_test_my_bucket%{random_suffix}" | ||
| location = "US" | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
| resource "google_storage_bucket_object" "metadata_folder" { | ||
| name = "metadata/" | ||
| content = " " | ||
| bucket = google_storage_bucket.bucket.name | ||
| } | ||
| resource "google_storage_bucket_object" "data_folder" { | ||
| name = "data/" | ||
| content = " " | ||
| bucket = google_storage_bucket.bucket.name | ||
| } | ||
| resource "google_biglake_database" "database" { | ||
| name = "tf_test_my_database%{random_suffix}" | ||
| catalog = google_biglake_catalog.catalog.id | ||
| type = "HIVE" | ||
| hive_options { | ||
| location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.metadata_folder.name}" | ||
| parameters = { | ||
| "owner" = "Alex" | ||
| } | ||
| } | ||
| } | ||
| resource "google_biglake_table" "table" { | ||
| name = "tf_test_my_table%{random_suffix}" | ||
| database = google_biglake_database.database.id | ||
| type = "HIVE" | ||
| hive_options { | ||
| table_type = "EXTERNAL_TABLE" | ||
| storage_descriptor { | ||
|
nevzheng marked this conversation as resolved.
|
||
| location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.data_folder.name}/data" | ||
| input_format = "org.apache.hadoop.mapred.SequenceFileInputFormat2" | ||
| output_format = "org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat2" | ||
| } | ||
| # Some Example Parameters. | ||
| parameters = { | ||
| # Bump the version. | ||
| "spark.sql.create.version" = "3.1.7" | ||
| "spark.sql.sources.schema.numParts" = "1" | ||
| # Update the time. | ||
| "transient_lastDdlTime" = "1680895000" | ||
| "spark.sql.partitionProvider" = "catalog" | ||
| # Change The Name | ||
| "owner" = "Dana" | ||
| "spark.sql.sources.schema.part.0" = "{\"type\":\"struct\",\"fields\":[{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}" | ||
| "spark.sql.sources.provider": "iceberg" | ||
| "provider" = "iceberg" | ||
| } | ||
| } | ||
| } | ||
| `, context) | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.