Skip to content

Commit 59a73e5

Browse files
feat: added optional description parameter (#213)
Co-authored-by: Iban Tanovic <ibantanovic> Co-authored-by: Awais Malik <malik.awais@gmail.com> Co-authored-by: Awais Malik <awmalik@google.com>
1 parent a41234c commit 59a73e5

File tree

7 files changed

+41
-13
lines changed

7 files changed

+41
-13
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ This module provisions a dataset and a list of tables with associated JSON schem
193193
| deletion\_protection | Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the instance will fail | `bool` | `false` | no |
194194
| description | Dataset description. | `string` | `null` | no |
195195
| encryption\_key | Default encryption key to apply to the dataset. Defaults to null (Google-managed). | `string` | `null` | no |
196-
| external\_tables | A list of objects which include table\_id, expiration\_time, external\_data\_configuration, and labels. | <pre>list(object({<br> table_id = string,<br> autodetect = bool,<br> compression = string,<br> ignore_unknown_values = bool,<br> max_bad_records = number,<br> schema = string,<br> source_format = string,<br> source_uris = list(string),<br> csv_options = object({<br> quote = string,<br> allow_jagged_rows = bool,<br> allow_quoted_newlines = bool,<br> encoding = string,<br> field_delimiter = string,<br> skip_leading_rows = number,<br> }),<br> google_sheets_options = object({<br> range = string,<br> skip_leading_rows = number,<br> }),<br> hive_partitioning_options = object({<br> mode = string,<br> source_uri_prefix = string,<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
196+
| external\_tables | A list of objects which include table\_id, expiration\_time, external\_data\_configuration, and labels. | <pre>list(object({<br> table_id = string,<br> description = optional(string),<br> autodetect = bool,<br> compression = string,<br> ignore_unknown_values = bool,<br> max_bad_records = number,<br> schema = string,<br> source_format = string,<br> source_uris = list(string),<br> csv_options = object({<br> quote = string,<br> allow_jagged_rows = bool,<br> allow_quoted_newlines = bool,<br> encoding = string,<br> field_delimiter = string,<br> skip_leading_rows = number,<br> }),<br> google_sheets_options = object({<br> range = string,<br> skip_leading_rows = number,<br> }),<br> hive_partitioning_options = object({<br> mode = string,<br> source_uri_prefix = string,<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
197197
| location | The regional location for the dataset only US and EU are allowed in module | `string` | `"US"` | no |
198-
| materialized\_views | A list of objects which includes view\_id, view\_query, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels | <pre>list(object({<br> view_id = string,<br> query = string,<br> enable_refresh = bool,<br> refresh_interval_ms = string,<br> clustering = list(string),<br> time_partitioning = object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> require_partition_filter = bool,<br> }),<br> range_partitioning = object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
198+
| materialized\_views | A list of objects which includes view\_id, view\_query, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels | <pre>list(object({<br> view_id = string,<br> description = optional(string),<br> query = string,<br> enable_refresh = bool,<br> refresh_interval_ms = string,<br> clustering = list(string),<br> time_partitioning = object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> require_partition_filter = bool,<br> }),<br> range_partitioning = object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
199199
| max\_time\_travel\_hours | Defines the time travel window in hours | `number` | `null` | no |
200200
| project\_id | Project where the dataset and table are created | `string` | n/a | yes |
201201
| routines | A list of objects which include routine\_id, routine\_type, routine\_language, definition\_body, return\_type, routine\_description and arguments. | <pre>list(object({<br> routine_id = string,<br> routine_type = string,<br> language = string,<br> definition_body = string,<br> return_type = string,<br> description = string,<br> arguments = list(object({<br> name = string,<br> data_type = string,<br> argument_kind = string,<br> mode = string,<br> })),<br> }))</pre> | `[]` | no |
202-
| tables | A list of objects which include table\_id, table\_name, schema, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels. | <pre>list(object({<br> table_id = string,<br> table_name = optional(string),<br> schema = string,<br> clustering = list(string),<br> time_partitioning = object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> require_partition_filter = bool,<br> }),<br> range_partitioning = object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
203-
| views | A list of objects which include view\_id and view query | <pre>list(object({<br> view_id = string,<br> query = string,<br> use_legacy_sql = bool,<br> labels = map(string),<br> }))</pre> | `[]` | no |
202+
| tables | A list of objects which include table\_id, table\_name, schema, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels. | <pre>list(object({<br> table_id = string,<br> description = optional(string),<br> table_name = optional(string),<br> schema = string,<br> clustering = list(string),<br> time_partitioning = object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> require_partition_filter = bool,<br> }),<br> range_partitioning = object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }),<br> expiration_time = string,<br> labels = map(string),<br> }))</pre> | `[]` | no |
203+
| views | A list of objects which include view\_id and view query | <pre>list(object({<br> view_id = string,<br> description = optional(string),<br> query = string,<br> use_legacy_sql = bool,<br> labels = map(string),<br> }))</pre> | `[]` | no |
204204

205205
## Outputs
206206

main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ resource "google_bigquery_table" "main" {
6969
dataset_id = google_bigquery_dataset.main.dataset_id
7070
friendly_name = each.value["table_name"] != null ? each.value["table_name"] : each.key
7171
table_id = each.key
72+
description = each.value["description"]
7273
labels = each.value["labels"]
7374
schema = each.value["schema"]
7475
clustering = each.value["clustering"]
@@ -110,6 +111,7 @@ resource "google_bigquery_table" "view" {
110111
dataset_id = google_bigquery_dataset.main.dataset_id
111112
friendly_name = each.key
112113
table_id = each.key
114+
description = each.value["description"]
113115
labels = each.value["labels"]
114116
project = var.project_id
115117
deletion_protection = false
@@ -131,6 +133,7 @@ resource "google_bigquery_table" "materialized_view" {
131133
dataset_id = google_bigquery_dataset.main.dataset_id
132134
friendly_name = each.key
133135
table_id = each.key
136+
description = each.value["description"]
134137
labels = each.value["labels"]
135138
clustering = each.value["clustering"]
136139
expiration_time = each.value["expiration_time"]
@@ -177,6 +180,7 @@ resource "google_bigquery_table" "external_table" {
177180
dataset_id = google_bigquery_dataset.main.dataset_id
178181
friendly_name = each.key
179182
table_id = each.key
183+
description = each.value["description"]
180184
labels = each.value["labels"]
181185
expiration_time = each.value["expiration_time"]
182186
project = var.project_id

metadata.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ spec:
9090
type: |-
9191
list(object({
9292
table_id = string,
93+
description = optional(string),
9394
autodetect = bool,
9495
compression = string,
9596
ignore_unknown_values = bool,
@@ -128,6 +129,7 @@ spec:
128129
type: |-
129130
list(object({
130131
view_id = string,
132+
description = optional(string),
131133
query = string,
132134
enable_refresh = bool,
133135
refresh_interval_ms = string,
@@ -178,9 +180,10 @@ spec:
178180
description: A list of objects which include table_id, schema, clustering, time_partitioning, range_partitioning, expiration_time and labels.
179181
type: |-
180182
list(object({
181-
table_id = string,
182-
schema = string,
183-
clustering = list(string),
183+
table_id = string,
184+
description = optional(string),
185+
schema = string,
186+
clustering = list(string),
184187
time_partitioning = object({
185188
expiration_ms = string,
186189
field = string,
@@ -205,6 +208,7 @@ spec:
205208
type: |-
206209
list(object({
207210
view_id = string,
211+
description = optional(string),
208212
query = string,
209213
use_legacy_sql = bool,
210214
labels = map(string),

modules/data_warehouse/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*.zip
2-
terraform.tfvars
2+
terraform.tfvars

modules/data_warehouse/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ Functional examples are included in the
4747
| ds\_friendly\_name | Dataset name |
4848
| function\_uri | Function URI |
4949
| lookerstudio\_report\_url | The URL to create a new Looker Studio report displays a sample dashboard for the taxi data analysis |
50+
| neos\_tutorial\_url | The URL to launch the in-console tutorial for the EDW solution |
5051
| raw\_bucket | Raw bucket name |
52+
| solution\_guide\_url | The URL to Solution Guide for the EDW solution |
5153

5254
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5355

modules/data_warehouse/assets/workflows/workflow.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Run the Cloud Function from Workflows
216

317
main:
418
params: [event]
519
steps:
620
- assign_values:
721
assign:
8-
- cloud_function_url: ${cloud_function_url}
22+
- cloud_function_url: ${cloud_function_url}
923
- call_cloud_function:
1024
call: http.get
1125
args:

variables.tf

+8-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ variable "tables" {
9898
description = "A list of objects which include table_id, table_name, schema, clustering, time_partitioning, range_partitioning, expiration_time and labels."
9999
default = []
100100
type = list(object({
101-
table_id = string,
102-
table_name = optional(string),
103-
schema = string,
104-
clustering = list(string),
101+
table_id = string,
102+
description = optional(string),
103+
table_name = optional(string),
104+
schema = string,
105+
clustering = list(string),
105106
time_partitioning = object({
106107
expiration_ms = string,
107108
field = string,
@@ -126,6 +127,7 @@ variable "views" {
126127
default = []
127128
type = list(object({
128129
view_id = string,
130+
description = optional(string),
129131
query = string,
130132
use_legacy_sql = bool,
131133
labels = map(string),
@@ -137,6 +139,7 @@ variable "materialized_views" {
137139
default = []
138140
type = list(object({
139141
view_id = string,
142+
description = optional(string),
140143
query = string,
141144
enable_refresh = bool,
142145
refresh_interval_ms = string,
@@ -165,6 +168,7 @@ variable "external_tables" {
165168
default = []
166169
type = list(object({
167170
table_id = string,
171+
description = optional(string),
168172
autodetect = bool,
169173
compression = string,
170174
ignore_unknown_values = bool,

0 commit comments

Comments
 (0)