Skip to content

Commit

Permalink
feat!: add support to max_staleness field (#278)
Browse files Browse the repository at this point in the history
Co-authored-by: Bharath KKB <[email protected]>
  • Loading branch information
msgongora and bharathkkb authored Nov 10, 2023
1 parent 85b9d22 commit 4c51616
Show file tree
Hide file tree
Showing 16 changed files with 382 additions and 362 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ This module provisions a dataset and a list of tables with associated JSON schem
| 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 |
| 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. | <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 |
| 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> labels = map(string),<br> }))</pre> | `[]` | 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 | <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 |
| 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 |
| 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 |
| 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 |
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_bq/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ terraform {
source = "hashicorp/google"
}
}
required_version = ">= 0.13"
required_version = ">= 1.3"
}
2 changes: 1 addition & 1 deletion examples/basic_view/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ terraform {
source = "hashicorp/google"
}
}
required_version = ">= 0.13"
required_version = ">= 1.3"
}
2 changes: 1 addition & 1 deletion examples/multiple_tables/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ terraform {
source = "hashicorp/google"
}
}
required_version = ">= 0.13"
required_version = ">= 1.3"
}
2 changes: 1 addition & 1 deletion examples/scheduled_queries/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
terraform {
required_version = ">= 0.13"
required_version = ">= 1.3"
required_providers {

google = {
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ resource "google_bigquery_table" "materialized_view" {
labels = each.value["labels"]
clustering = each.value["clustering"]
expiration_time = each.value["expiration_time"] != null ? each.value["expiration_time"] : 0
max_staleness = each.value["max_staleness"]
project = var.project_id
deletion_protection = false

Expand Down Expand Up @@ -183,6 +184,7 @@ resource "google_bigquery_table" "external_table" {
description = each.value["description"]
labels = each.value["labels"]
expiration_time = each.value["expiration_time"] != null ? each.value["expiration_time"] : 0
max_staleness = each.value["max_staleness"]
project = var.project_id
deletion_protection = var.deletion_protection

Expand Down
Loading

0 comments on commit 4c51616

Please sign in to comment.