From efd7b4e26aa116054b81f797b0e738bae442ed03 Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Wed, 5 Mar 2025 04:50:51 +0000 Subject: [PATCH 1/3] add default values for input variables --- README.md | 8 ++++---- metadata.yaml | 36 ++++++++++++++++++------------------ variables.tf | 34 +++++++++++++++++----------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 3c82982c..08b60d09 100644 --- a/README.md +++ b/README.md @@ -198,14 +198,14 @@ This module provisions a dataset and a list of tables with associated JSON schem | encryption\_key | Default encryption key to apply to the dataset. Defaults to null (Google-managed). | `string` | `null` | no | | external\_tables | A list of objects which include table\_id, expiration\_time, external\_data\_configuration, and labels. |
list(object({
table_id = string,
description = optional(string),
autodetect = bool,
compression = string,
ignore_unknown_values = bool,
max_bad_records = number,
schema = string,
source_format = string,
source_uris = list(string),
csv_options = object({
quote = string,
allow_jagged_rows = bool,
allow_quoted_newlines = bool,
encoding = string,
field_delimiter = string,
skip_leading_rows = number,
}),
google_sheets_options = object({
range = string,
skip_leading_rows = number,
}),
hive_partitioning_options = object({
mode = string,
source_uri_prefix = string,
}),
expiration_time = string,
max_staleness = optional(string),
deletion_protection = optional(bool),
labels = map(string),
}))
| `[]` | no | | location | The regional location for the dataset only US and EU are allowed in module | `string` | `"US"` | no | -| materialized\_views | A list of objects which includes view\_id, view\_query, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels |
list(object({
view_id = string,
description = optional(string),
query = string,
enable_refresh = bool,
refresh_interval_ms = string,
clustering = list(string),
time_partitioning = object({
expiration_ms = string,
field = string,
type = string,
require_partition_filter = bool,
}),
range_partitioning = object({
field = string,
range = object({
start = string,
end = string,
interval = string,
}),
}),
expiration_time = string,
max_staleness = optional(string),
labels = map(string),
}))
| `[]` | no | +| materialized\_views | A list of objects which includes view\_id, view\_query, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels |
list(object({
view_id = string,
description = optional(string),
query = string,
enable_refresh = bool,
refresh_interval_ms = string,
clustering = optional(list(string), []),
time_partitioning = optional(object({
expiration_ms = string,
field = string,
type = string,
require_partition_filter = bool,
}), null),
range_partitioning = optional(object({
field = string,
range = object({
start = string,
end = string,
interval = string,
}),
}), null),
expiration_time = optional(string, null),
max_staleness = optional(string),
labels = optional(map(string), {}),
}))
| `[]` | no | | max\_time\_travel\_hours | Defines the time travel window in hours | `number` | `null` | no | | project\_id | Project where the dataset and table are created | `string` | n/a | yes | | resource\_tags | A map of resource tags to add to the dataset | `map(string)` | `{}` | no | -| routines | A list of objects which include routine\_id, routine\_type, routine\_language, definition\_body, return\_type, routine\_description and arguments. |
list(object({
routine_id = string,
routine_type = string,
language = string,
definition_body = string,
return_type = string,
description = string,
arguments = list(object({
name = string,
data_type = string,
argument_kind = string,
mode = string,
})),
}))
| `[]` | no | +| routines | A list of objects which include routine\_id, routine\_type, routine\_language, definition\_body, return\_type, routine\_description and arguments. |
list(object({
routine_id = string,
routine_type = string,
language = string,
definition_body = string,
return_type = string,
description = string,
arguments = optional(list(object({
name = string,
data_type = string,
argument_kind = string,
mode = string,
})), []),
}))
| `[]` | no | | storage\_billing\_model | Specifies the storage billing model for the dataset. Set this flag value to LOGICAL to use logical bytes for storage billing, or to PHYSICAL to use physical bytes instead. LOGICAL is the default if this flag isn't specified. | `string` | `null` | no | -| tables | A list of objects which include table\_id, table\_name, schema, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels. |
list(object({
table_id = string,
description = optional(string),
table_name = optional(string),
schema = string,
clustering = list(string),
require_partition_filter = optional(bool),
time_partitioning = object({
expiration_ms = string,
field = string,
type = string,
}),
range_partitioning = object({
field = string,
range = object({
start = string,
end = string,
interval = string,
}),
}),
expiration_time = string,
deletion_protection = optional(bool),
labels = map(string),
}))
| `[]` | no | -| views | A list of objects which include view\_id and view query |
list(object({
view_id = string,
description = optional(string),
query = string,
use_legacy_sql = bool,
labels = map(string),
}))
| `[]` | no | +| tables | A list of objects which include table\_id, table\_name, schema, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels. |
list(object({
table_id = string,
description = optional(string),
table_name = optional(string),
schema = string,
clustering = optional(list(string), []),
require_partition_filter = optional(bool),
time_partitioning = optional(object({
expiration_ms = string,
field = string,
type = string,
}), null),
range_partitioning = optional(object({
field = string,
range = object({
start = string,
end = string,
interval = string,
}),
}), null),
expiration_time = optional(string, null),
deletion_protection = optional(bool),
labels = optional(map(string), {}),
}))
| `[]` | no | +| views | A list of objects which include view\_id and view query |
list(object({
view_id = string,
description = optional(string),
query = string,
use_legacy_sql = bool,
labels = optional(map(string), {}),
}))
| `[]` | no | ## Outputs diff --git a/metadata.yaml b/metadata.yaml index 373a9c6d..4065f2f9 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-bigquery sourceType: git - version: 10.0.0 + version: 10.0.1 actuationTool: flavor: Terraform version: ">= 1.3" @@ -114,24 +114,24 @@ spec: description = optional(string), table_name = optional(string), schema = string, - clustering = list(string), + clustering = optional(list(string), []), require_partition_filter = optional(bool), - time_partitioning = object({ + time_partitioning = optional(object({ expiration_ms = string, field = string, type = string, - }), - range_partitioning = object({ + }), null), + range_partitioning = optional(object({ field = string, range = object({ start = string, end = string, interval = string, }), - }), - expiration_time = string, + }), null), + expiration_time = optional(string, null), deletion_protection = optional(bool), - labels = map(string), + labels = optional(map(string), {}), })) defaultValue: [] - name: views @@ -142,7 +142,7 @@ spec: description = optional(string), query = string, use_legacy_sql = bool, - labels = map(string), + labels = optional(map(string), {}), })) defaultValue: [] - name: materialized_views @@ -154,24 +154,24 @@ spec: query = string, enable_refresh = bool, refresh_interval_ms = string, - clustering = list(string), - time_partitioning = object({ + clustering = optional(list(string), []), + time_partitioning = optional(object({ expiration_ms = string, field = string, type = string, require_partition_filter = bool, - }), - range_partitioning = object({ + }), null), + range_partitioning = optional(object({ field = string, range = object({ start = string, end = string, interval = string, }), - }), - expiration_time = string, + }), null), + expiration_time = optional(string, null), max_staleness = optional(string), - labels = map(string), + labels = optional(map(string), {}), })) defaultValue: [] - name: external_tables @@ -219,12 +219,12 @@ spec: definition_body = string, return_type = string, description = string, - arguments = list(object({ + arguments = optional(list(object({ name = string, data_type = string, argument_kind = string, mode = string, - })), + })), []), })) defaultValue: [] outputs: diff --git a/variables.tf b/variables.tf index 74605051..a84fceb4 100644 --- a/variables.tf +++ b/variables.tf @@ -125,24 +125,24 @@ variable "tables" { description = optional(string), table_name = optional(string), schema = string, - clustering = list(string), + clustering = optional(list(string), []), require_partition_filter = optional(bool), - time_partitioning = object({ + time_partitioning = optional(object({ expiration_ms = string, field = string, type = string, - }), - range_partitioning = object({ + }), null), + range_partitioning = optional(object({ field = string, range = object({ start = string, end = string, interval = string, }), - }), - expiration_time = string, + }), null), + expiration_time = optional(string, null), deletion_protection = optional(bool), - labels = map(string), + labels = optional(map(string), {}), })) } @@ -154,7 +154,7 @@ variable "views" { description = optional(string), query = string, use_legacy_sql = bool, - labels = map(string), + labels = optional(map(string), {}), })) } @@ -167,24 +167,24 @@ variable "materialized_views" { query = string, enable_refresh = bool, refresh_interval_ms = string, - clustering = list(string), - time_partitioning = object({ + clustering = optional(list(string), []), + time_partitioning = optional(object({ expiration_ms = string, field = string, type = string, require_partition_filter = bool, - }), - range_partitioning = object({ + }), null), + range_partitioning = optional(object({ field = string, range = object({ start = string, end = string, interval = string, }), - }), - expiration_time = string, + }), null), + expiration_time = optional(string, null), max_staleness = optional(string), - labels = map(string), + labels = optional(map(string), {}), })) } @@ -235,11 +235,11 @@ variable "routines" { definition_body = string, return_type = string, description = string, - arguments = list(object({ + arguments = optional(list(object({ name = string, data_type = string, argument_kind = string, mode = string, - })), + })), []), })) } From 70936329a77ad45619aa12fcef961fd0d2e8e04b Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Wed, 5 Mar 2025 09:57:14 +0000 Subject: [PATCH 2/3] revert back metadata version --- metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.yaml b/metadata.yaml index 4065f2f9..c4572d88 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-bigquery sourceType: git - version: 10.0.1 + version: 10.0.0 actuationTool: flavor: Terraform version: ">= 1.3" From 4e09ca7fdc51ec6d10fe6e24f1a569c6524694ee Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Wed, 5 Mar 2025 10:42:50 +0000 Subject: [PATCH 3/3] change description for location input variable --- README.md | 4 ++-- metadata.yaml | 6 +++--- variables.tf | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 08b60d09..304e3807 100644 --- a/README.md +++ b/README.md @@ -196,8 +196,8 @@ This module provisions a dataset and a list of tables with associated JSON schem | deletion\_protection | Whether or not to allow deletion of tables and external tables defined by this module. Can be overriden by table-level deletion\_protection configuration. | `bool` | `false` | no | | description | Dataset description. | `string` | `null` | no | | encryption\_key | Default encryption key to apply to the dataset. Defaults to null (Google-managed). | `string` | `null` | no | -| external\_tables | A list of objects which include table\_id, expiration\_time, external\_data\_configuration, and labels. |
list(object({
table_id = string,
description = optional(string),
autodetect = bool,
compression = string,
ignore_unknown_values = bool,
max_bad_records = number,
schema = string,
source_format = string,
source_uris = list(string),
csv_options = object({
quote = string,
allow_jagged_rows = bool,
allow_quoted_newlines = bool,
encoding = string,
field_delimiter = string,
skip_leading_rows = number,
}),
google_sheets_options = object({
range = string,
skip_leading_rows = number,
}),
hive_partitioning_options = object({
mode = string,
source_uri_prefix = string,
}),
expiration_time = string,
max_staleness = optional(string),
deletion_protection = optional(bool),
labels = map(string),
}))
| `[]` | no | -| location | The regional location for the dataset only US and EU are allowed in module | `string` | `"US"` | no | +| external\_tables | A list of objects which include table\_id, expiration\_time, external\_data\_configuration, and labels. |
list(object({
table_id = string,
description = optional(string),
autodetect = bool,
compression = string,
ignore_unknown_values = bool,
max_bad_records = number,
schema = string,
source_format = string,
source_uris = list(string),
csv_options = object({
quote = string,
allow_jagged_rows = bool,
allow_quoted_newlines = bool,
encoding = string,
field_delimiter = string,
skip_leading_rows = number,
}),
google_sheets_options = object({
range = string,
skip_leading_rows = number,
}),
hive_partitioning_options = object({
mode = string,
source_uri_prefix = string,
}),
expiration_time = optional(string, null),
max_staleness = optional(string),
deletion_protection = optional(bool),
labels = optional(map(string), {}),
}))
| `[]` | no | +| location | The location of the dataset. For multi-region, US or EU can be provided. | `string` | `"US"` | no | | materialized\_views | A list of objects which includes view\_id, view\_query, clustering, time\_partitioning, range\_partitioning, expiration\_time and labels |
list(object({
view_id = string,
description = optional(string),
query = string,
enable_refresh = bool,
refresh_interval_ms = string,
clustering = optional(list(string), []),
time_partitioning = optional(object({
expiration_ms = string,
field = string,
type = string,
require_partition_filter = bool,
}), null),
range_partitioning = optional(object({
field = string,
range = object({
start = string,
end = string,
interval = string,
}),
}), null),
expiration_time = optional(string, null),
max_staleness = optional(string),
labels = optional(map(string), {}),
}))
| `[]` | no | | max\_time\_travel\_hours | Defines the time travel window in hours | `number` | `null` | no | | project\_id | Project where the dataset and table are created | `string` | n/a | yes | diff --git a/metadata.yaml b/metadata.yaml index c4572d88..708703e1 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -63,7 +63,7 @@ spec: description: Dataset description. varType: string - name: location - description: The regional location for the dataset only US and EU are allowed in module + description: The location of the dataset. For multi-region, US or EU can be provided. varType: string defaultValue: US - name: delete_contents_on_destroy @@ -203,10 +203,10 @@ spec: mode = string, source_uri_prefix = string, }), - expiration_time = string, + expiration_time = optional(string, null), max_staleness = optional(string), deletion_protection = optional(bool), - labels = map(string), + labels = optional(map(string), {}), })) defaultValue: [] - name: routines diff --git a/variables.tf b/variables.tf index a84fceb4..28ca7a8b 100644 --- a/variables.tf +++ b/variables.tf @@ -32,7 +32,7 @@ variable "description" { } variable "location" { - description = "The regional location for the dataset only US and EU are allowed in module" + description = "The location of the dataset. For multi-region, US or EU can be provided." type = string default = "US" } @@ -217,10 +217,10 @@ variable "external_tables" { mode = string, source_uri_prefix = string, }), - expiration_time = string, + expiration_time = optional(string, null), max_staleness = optional(string), deletion_protection = optional(bool), - labels = map(string), + labels = optional(map(string), {}), })) }