Skip to content

Commit e27d2bb

Browse files
committed
fix!: materialized_view require_partition_filter moved to top
1 parent 49dbd7c commit e27d2bb

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ This module provisions a dataset and a list of tables with associated JSON schem
197197
| encryption\_key | Default encryption key to apply to the dataset. Defaults to null (Google-managed). | `string` | `null` | no |
198198
| 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 |
199199
| location | The regional location for the dataset only US and EU are allowed in module | `string` | `"US"` | no |
200-
| 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 |
200+
| 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> 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> max_staleness = optional(string),<br> labels = map(string),<br> }))</pre> | `[]` | no |
201201
| max\_time\_travel\_hours | Defines the time travel window in hours | `number` | `null` | no |
202202
| project\_id | Project where the dataset and table are created | `string` | n/a | yes |
203203
| resource\_tags | A map of resource tags to add to the dataset | `map(string)` | `{}` | no |

main.tf

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,25 @@ resource "google_bigquery_table" "view" {
130130
}
131131

132132
resource "google_bigquery_table" "materialized_view" {
133-
for_each = local.materialized_views
134-
dataset_id = google_bigquery_dataset.main.dataset_id
135-
friendly_name = each.key
136-
table_id = each.key
137-
description = each.value["description"]
138-
labels = each.value["labels"]
139-
clustering = each.value["clustering"]
140-
expiration_time = each.value["expiration_time"] != null ? each.value["expiration_time"] : 0
141-
max_staleness = each.value["max_staleness"]
142-
project = var.project_id
143-
deletion_protection = false
133+
for_each = local.materialized_views
134+
dataset_id = google_bigquery_dataset.main.dataset_id
135+
friendly_name = each.key
136+
table_id = each.key
137+
description = each.value["description"]
138+
labels = each.value["labels"]
139+
clustering = each.value["clustering"]
140+
expiration_time = each.value["expiration_time"] != null ? each.value["expiration_time"] : 0
141+
max_staleness = each.value["max_staleness"]
142+
project = var.project_id
143+
deletion_protection = false
144+
require_partition_filter = each.value["require_partition_filter"]
144145

145146
dynamic "time_partitioning" {
146147
for_each = each.value["time_partitioning"] != null ? [each.value["time_partitioning"]] : []
147148
content {
148-
type = time_partitioning.value["type"]
149-
expiration_ms = time_partitioning.value["expiration_ms"] != null ? time_partitioning.value["expiration_ms"] : 0
150-
field = time_partitioning.value["field"]
151-
require_partition_filter = time_partitioning.value["require_partition_filter"]
149+
type = time_partitioning.value["type"]
150+
expiration_ms = time_partitioning.value["expiration_ms"] != null ? time_partitioning.value["expiration_ms"] : 0
151+
field = time_partitioning.value["field"]
152152
}
153153
}
154154

metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ spec:
149149
enable_refresh = bool,
150150
refresh_interval_ms = string,
151151
clustering = list(string),
152+
require_partition_filter = optional(bool),
152153
time_partitioning = object({
153154
expiration_ms = string,
154155
field = string,
155156
type = string,
156-
require_partition_filter = bool,
157157
}),
158158
range_partitioning = object({
159159
field = string,

variables.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ variable "materialized_views" {
145145
description = "A list of objects which includes view_id, view_query, clustering, time_partitioning, range_partitioning, expiration_time and labels"
146146
default = []
147147
type = list(object({
148-
view_id = string,
149-
description = optional(string),
150-
query = string,
151-
enable_refresh = bool,
152-
refresh_interval_ms = string,
153-
clustering = list(string),
148+
view_id = string,
149+
description = optional(string),
150+
query = string,
151+
enable_refresh = bool,
152+
refresh_interval_ms = string,
153+
clustering = list(string),
154+
require_partition_filter = optional(bool),
154155
time_partitioning = object({
155-
expiration_ms = string,
156-
field = string,
157-
type = string,
158-
require_partition_filter = bool,
156+
expiration_ms = string,
157+
field = string,
158+
type = string,
159159
}),
160160
range_partitioning = object({
161161
field = string,

0 commit comments

Comments
 (0)