Skip to content

Commit cd4ab5e

Browse files
authored
fix: Make non-required object fields as optional for input variables (#377)
1 parent ab7fbda commit cd4ab5e

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,16 @@ This module provisions a dataset and a list of tables with associated JSON schem
196196
| 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 |
197197
| description | Dataset description. | `string` | `null` | no |
198198
| encryption\_key | Default encryption key to apply to the dataset. Defaults to null (Google-managed). | `string` | `null` | no |
199-
| 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> max_staleness = optional(string),<br> deletion_protection = optional(bool),<br> labels = map(string),<br> }))</pre> | `[]` | no |
200-
| location | The regional location for the dataset only US and EU are allowed in module | `string` | `"US"` | no |
201-
| 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> max_staleness = optional(string),<br> labels = map(string),<br> }))</pre> | `[]` | no |
199+
| 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 = optional(string, null),<br> max_staleness = optional(string),<br> deletion_protection = optional(bool),<br> labels = optional(map(string), {}),<br> }))</pre> | `[]` | no |
200+
| location | The location of the dataset. For multi-region, US or EU can be provided. | `string` | `"US"` | no |
201+
| 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 = optional(list(string), []),<br> time_partitioning = optional(object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> require_partition_filter = bool,<br> }), null),<br> range_partitioning = optional(object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }), null),<br> expiration_time = optional(string, null),<br> max_staleness = optional(string),<br> labels = optional(map(string), {}),<br> }))</pre> | `[]` | no |
202202
| max\_time\_travel\_hours | Defines the time travel window in hours | `number` | `null` | no |
203203
| project\_id | Project where the dataset and table are created | `string` | n/a | yes |
204204
| resource\_tags | A map of resource tags to add to the dataset | `map(string)` | `{}` | no |
205-
| 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 |
205+
| 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 = optional(list(object({<br> name = string,<br> data_type = string,<br> argument_kind = string,<br> mode = string,<br> })), []),<br> }))</pre> | `[]` | no |
206206
| 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 |
207-
| 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> require_partition_filter = optional(bool),<br> time_partitioning = object({<br> expiration_ms = string,<br> field = string,<br> type = string,<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> deletion_protection = optional(bool),<br> labels = map(string),<br> }))</pre> | `[]` | no |
208-
| 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 |
207+
| 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 = optional(list(string), []),<br> require_partition_filter = optional(bool),<br> time_partitioning = optional(object({<br> expiration_ms = string,<br> field = string,<br> type = string,<br> }), null),<br> range_partitioning = optional(object({<br> field = string,<br> range = object({<br> start = string,<br> end = string,<br> interval = string,<br> }),<br> }), null),<br> expiration_time = optional(string, null),<br> deletion_protection = optional(bool),<br> labels = optional(map(string), {}),<br> }))</pre> | `[]` | no |
208+
| 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 = optional(map(string), {}),<br> }))</pre> | `[]` | no |
209209

210210
## Outputs
211211

metadata.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ spec:
6363
description: Dataset description.
6464
varType: string
6565
- name: location
66-
description: The regional location for the dataset only US and EU are allowed in module
66+
description: The location of the dataset. For multi-region, US or EU can be provided.
6767
varType: string
6868
defaultValue: US
6969
- name: delete_contents_on_destroy
@@ -114,24 +114,24 @@ spec:
114114
description = optional(string),
115115
table_name = optional(string),
116116
schema = string,
117-
clustering = list(string),
117+
clustering = optional(list(string), []),
118118
require_partition_filter = optional(bool),
119-
time_partitioning = object({
119+
time_partitioning = optional(object({
120120
expiration_ms = string,
121121
field = string,
122122
type = string,
123-
}),
124-
range_partitioning = object({
123+
}), null),
124+
range_partitioning = optional(object({
125125
field = string,
126126
range = object({
127127
start = string,
128128
end = string,
129129
interval = string,
130130
}),
131-
}),
132-
expiration_time = string,
131+
}), null),
132+
expiration_time = optional(string, null),
133133
deletion_protection = optional(bool),
134-
labels = map(string),
134+
labels = optional(map(string), {}),
135135
}))
136136
defaultValue: []
137137
- name: views
@@ -142,7 +142,7 @@ spec:
142142
description = optional(string),
143143
query = string,
144144
use_legacy_sql = bool,
145-
labels = map(string),
145+
labels = optional(map(string), {}),
146146
}))
147147
defaultValue: []
148148
- name: materialized_views
@@ -154,24 +154,24 @@ spec:
154154
query = string,
155155
enable_refresh = bool,
156156
refresh_interval_ms = string,
157-
clustering = list(string),
158-
time_partitioning = object({
157+
clustering = optional(list(string), []),
158+
time_partitioning = optional(object({
159159
expiration_ms = string,
160160
field = string,
161161
type = string,
162162
require_partition_filter = bool,
163-
}),
164-
range_partitioning = object({
163+
}), null),
164+
range_partitioning = optional(object({
165165
field = string,
166166
range = object({
167167
start = string,
168168
end = string,
169169
interval = string,
170170
}),
171-
}),
172-
expiration_time = string,
171+
}), null),
172+
expiration_time = optional(string, null),
173173
max_staleness = optional(string),
174-
labels = map(string),
174+
labels = optional(map(string), {}),
175175
}))
176176
defaultValue: []
177177
- name: external_tables
@@ -203,10 +203,10 @@ spec:
203203
mode = string,
204204
source_uri_prefix = string,
205205
}),
206-
expiration_time = string,
206+
expiration_time = optional(string, null),
207207
max_staleness = optional(string),
208208
deletion_protection = optional(bool),
209-
labels = map(string),
209+
labels = optional(map(string), {}),
210210
}))
211211
defaultValue: []
212212
- name: routines
@@ -219,12 +219,12 @@ spec:
219219
definition_body = string,
220220
return_type = string,
221221
description = string,
222-
arguments = list(object({
222+
arguments = optional(list(object({
223223
name = string,
224224
data_type = string,
225225
argument_kind = string,
226226
mode = string,
227-
})),
227+
})), []),
228228
}))
229229
defaultValue: []
230230
outputs:

variables.tf

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ variable "description" {
3232
}
3333

3434
variable "location" {
35-
description = "The regional location for the dataset only US and EU are allowed in module"
35+
description = "The location of the dataset. For multi-region, US or EU can be provided."
3636
type = string
3737
default = "US"
3838
}
@@ -125,24 +125,24 @@ variable "tables" {
125125
description = optional(string),
126126
table_name = optional(string),
127127
schema = string,
128-
clustering = list(string),
128+
clustering = optional(list(string), []),
129129
require_partition_filter = optional(bool),
130-
time_partitioning = object({
130+
time_partitioning = optional(object({
131131
expiration_ms = string,
132132
field = string,
133133
type = string,
134-
}),
135-
range_partitioning = object({
134+
}), null),
135+
range_partitioning = optional(object({
136136
field = string,
137137
range = object({
138138
start = string,
139139
end = string,
140140
interval = string,
141141
}),
142-
}),
143-
expiration_time = string,
142+
}), null),
143+
expiration_time = optional(string, null),
144144
deletion_protection = optional(bool),
145-
labels = map(string),
145+
labels = optional(map(string), {}),
146146
}))
147147
}
148148

@@ -154,7 +154,7 @@ variable "views" {
154154
description = optional(string),
155155
query = string,
156156
use_legacy_sql = bool,
157-
labels = map(string),
157+
labels = optional(map(string), {}),
158158
}))
159159
}
160160

@@ -167,24 +167,24 @@ variable "materialized_views" {
167167
query = string,
168168
enable_refresh = bool,
169169
refresh_interval_ms = string,
170-
clustering = list(string),
171-
time_partitioning = object({
170+
clustering = optional(list(string), []),
171+
time_partitioning = optional(object({
172172
expiration_ms = string,
173173
field = string,
174174
type = string,
175175
require_partition_filter = bool,
176-
}),
177-
range_partitioning = object({
176+
}), null),
177+
range_partitioning = optional(object({
178178
field = string,
179179
range = object({
180180
start = string,
181181
end = string,
182182
interval = string,
183183
}),
184-
}),
185-
expiration_time = string,
184+
}), null),
185+
expiration_time = optional(string, null),
186186
max_staleness = optional(string),
187-
labels = map(string),
187+
labels = optional(map(string), {}),
188188
}))
189189
}
190190

@@ -217,10 +217,10 @@ variable "external_tables" {
217217
mode = string,
218218
source_uri_prefix = string,
219219
}),
220-
expiration_time = string,
220+
expiration_time = optional(string, null),
221221
max_staleness = optional(string),
222222
deletion_protection = optional(bool),
223-
labels = map(string),
223+
labels = optional(map(string), {}),
224224
}))
225225
}
226226

@@ -235,11 +235,11 @@ variable "routines" {
235235
definition_body = string,
236236
return_type = string,
237237
description = string,
238-
arguments = list(object({
238+
arguments = optional(list(object({
239239
name = string,
240240
data_type = string,
241241
argument_kind = string,
242242
mode = string,
243-
})),
243+
})), []),
244244
}))
245245
}

0 commit comments

Comments
 (0)