Skip to content
Merged
Show file tree
Hide file tree
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 Aug 23, 2023
ab464a9
add: biglake table example
nevzheng Aug 23, 2023
3e4c7b1
add: biglake table update test
nevzheng Aug 23, 2023
2b02fb3
update: hive_options
nevzheng Aug 23, 2023
c4943b3
fix: wrong directory
nevzheng Aug 23, 2023
307f743
trim: trailing whitespace
nevzheng Aug 23, 2023
9b729ae
fix: incorrect example location
nevzheng Aug 23, 2023
286835f
delete: incorrect file
nevzheng Aug 23, 2023
24e0d26
add: acc tests for biglake table
nevzheng Aug 23, 2023
c4df7f9
Add SDK provider configuration tests, part 2 (#7723)
SarahFrench Aug 24, 2023
8caf6bf
TeamCity: Usability improvements : tag builds to distinguish nightly …
SarahFrench Aug 24, 2023
9604694
Add ignore read on reservedIpRange field Filestore Instance (#8520)
bsteinberg Aug 24, 2023
456e714
b-283271112 Add "additionalScopes" under webSsoConfig for the "groups…
vaibhav-google Aug 24, 2023
264f93f
Made breaking change detector own its own setup and build process (#8…
melinath Aug 24, 2023
f6b396b
Go changelog (#8727)
trodge Aug 24, 2023
5f2c515
Fix acctest import specifying the beta version instead of GA (#8736)
roaks3 Aug 24, 2023
ec7e816
Cleanup deprecated folders (#8720)
zli82016 Aug 24, 2023
8fa5827
Remove test lines from changelog checker (#8763)
ScottSuarez Aug 24, 2023
ef6b18e
Adds the synthetic monitor target type as an option for uptime checks…
dkoss Aug 24, 2023
a8982ad
Removed guard around operation WithResponse method & improved error h…
melinath Aug 25, 2023
fd06323
Add zli82016 to the vacation list (#8761)
zli82016 Aug 25, 2023
425cb45
Update example for google_compute_addresses data source (#8765)
alzabo Aug 25, 2023
fb415b9
Remove myself from vacation list (#8770)
rileykarson Aug 25, 2023
771116e
Document database flags type change (#8769)
smcgivern Aug 25, 2023
adeed2d
Added some missing what's next links (#8733)
melinath Aug 25, 2023
37c7843
Add: BigLake API Catalog Resource (#8751)
nevzheng Aug 25, 2023
d7154ba
Add workflow for membership checker unit tests (#8760)
trodge Aug 25, 2023
6cfe99b
Key upload (#8714)
bohengy Aug 25, 2023
9b944df
Marks `template.volumes.secret.items.mode` field not required in Clou…
yanweiguo Aug 25, 2023
d41ff15
Removed MembershipRBACRoleBinding from ga provider (#8776)
ScottSuarez Aug 25, 2023
2e5f8a5
make distribution_policy_target_shape updatable (#8774)
edwardmedia Aug 25, 2023
708d17e
feat(google_container_cluster): support fqdn network policy (#8461)
toVersus Aug 28, 2023
0db8c76
Redis cluster terraform support (#8567)
himanikh Aug 28, 2023
c0ce53f
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Aug 28, 2023
35852e5
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Aug 28, 2023
ba2e974
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Aug 29, 2023
906ce7c
move: Table.yaml to `biglake`
nevzheng Aug 29, 2023
47f71d1
update: switch to parent id convention
nevzheng Aug 29, 2023
87c4790
update: example to use parent id convention
nevzheng Aug 29, 2023
f9c2472
update: continue to update to parent convention
nevzheng Aug 29, 2023
46f67c0
add: biglake table custom import
nevzheng Aug 29, 2023
7f03e78
fix: correct usage of names
nevzheng Aug 29, 2023
510aae0
fix: extra comma
nevzheng Aug 29, 2023
1149968
fix: parameter spec.
nevzheng Aug 29, 2023
6d4815e
fix: parameters spec
nevzheng Aug 29, 2023
e397296
delete: remove location param
nevzheng Aug 29, 2023
6d512c7
fix: build
nevzheng Aug 29, 2023
48e50bb
fix: correct url
nevzheng Aug 29, 2023
57417c3
add: spec custom import
nevzheng Aug 29, 2023
4b83da6
Merge branch 'main' of github.com:GoogleCloudPlatform/magic-modules i…
nevzheng Aug 30, 2023
f8ece65
update: switch to id_format over custom import
nevzheng Aug 30, 2023
c525b91
fix: remove location from resource test.
nevzheng Aug 30, 2023
dc61fdb
fix: test names
nevzheng Aug 30, 2023
0ddc8ce
add: serde_info to acc test
nevzheng Aug 30, 2023
5b7154d
fix: serde_info is a struct
nevzheng Aug 30, 2023
d85b010
remove: serde_info due to api bug.
nevzheng Aug 31, 2023
f28d473
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Aug 31, 2023
64db563
delete: unsupported serdeinfo field
nevzheng Aug 31, 2023
7e573da
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Sep 1, 2023
850d040
fix: use example person names
nevzheng Sep 5, 2023
e0f5188
update: mark `database` immutable
nevzheng Sep 5, 2023
60adec6
update: change more fields in update test
nevzheng Sep 5, 2023
44fb0aa
Merge branch 'GoogleCloudPlatform:main' into add-biglake-table
nevzheng Sep 5, 2023
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
134 changes: 134 additions & 0 deletions mmv1/products/biglake/Table.yaml
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"
Comment thread
nevzheng marked this conversation as resolved.
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.
61 changes: 61 additions & 0 deletions mmv1/templates/terraform/examples/biglake_table.tf.erb
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"
Comment thread
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"
}
}
}
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 {
Comment thread
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)
}