diff --git a/README.md b/README.md index 29f08442..ea9b1457 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ This module provisions a dataset and a list of tables with associated JSON schem | dataset\_id | Unique ID for the dataset being provisioned. | `string` | n/a | yes | | dataset\_labels | Key value pairs in a map for dataset labels | `map(string)` | `{}` | no | | dataset\_name | Friendly name for the dataset being provisioned. | `string` | `null` | no | +| default\_partition\_expiration\_ms | The default partition expiration for all partitioned tables in the dataset, in MS | `number` | `null` | no | | default\_table\_expiration\_ms | TTL of tables using the dataset in MS | `number` | `null` | no | | delete\_contents\_on\_destroy | (Optional) If set to true, delete all the tables in the dataset when destroying the resource; otherwise, destroying the resource will fail if tables are present. | `bool` | `null` | no | | 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 | @@ -200,6 +201,7 @@ This module provisions a dataset and a list of tables with associated JSON schem | 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. |
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 | +| 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 | diff --git a/main.tf b/main.tf index aa7a6297..87991656 100644 --- a/main.tf +++ b/main.tf @@ -29,15 +29,17 @@ locals { } resource "google_bigquery_dataset" "main" { - dataset_id = var.dataset_id - friendly_name = var.dataset_name - description = var.description - location = var.location - delete_contents_on_destroy = var.delete_contents_on_destroy - default_table_expiration_ms = var.default_table_expiration_ms - max_time_travel_hours = var.max_time_travel_hours - project = var.project_id - labels = var.dataset_labels + dataset_id = var.dataset_id + friendly_name = var.dataset_name + description = var.description + location = var.location + delete_contents_on_destroy = var.delete_contents_on_destroy + default_table_expiration_ms = var.default_table_expiration_ms + default_partition_expiration_ms = var.default_partition_expiration_ms + max_time_travel_hours = var.max_time_travel_hours + storage_billing_model = var.storage_billing_model + project = var.project_id + labels = var.dataset_labels dynamic "default_encryption_configuration" { for_each = var.encryption_key == null ? [] : [var.encryption_key] diff --git a/metadata.display.yaml b/metadata.display.yaml index 81c5ec4a..789e1846 100644 --- a/metadata.display.yaml +++ b/metadata.display.yaml @@ -39,6 +39,9 @@ spec: dataset_name: name: dataset_name title: Dataset Name + default_partition_expiration_ms: + name: default_partition_expiration_ms + title: Default Partition Expiration Ms default_table_expiration_ms: name: default_table_expiration_ms title: Default Table Expiration Ms @@ -72,6 +75,9 @@ spec: routines: name: routines title: Routines + storage_billing_model: + name: storage_billing_model + title: Storage Billing Model tables: name: tables title: Tables diff --git a/metadata.yaml b/metadata.yaml index cd5af95e..f9239e3f 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -69,6 +69,9 @@ spec: - name: dataset_name description: Friendly name for the dataset being provisioned. varType: string + - name: default_partition_expiration_ms + description: The default partition expiration for all partitioned tables in the dataset, in MS + varType: number - name: default_table_expiration_ms description: TTL of tables using the dataset in MS varType: number @@ -178,6 +181,9 @@ spec: })), })) defaultValue: [] + - name: storage_billing_model + description: 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. + varType: string - name: tables description: A list of objects which include table_id, table_name, schema, clustering, time_partitioning, range_partitioning, expiration_time and labels. varType: |- diff --git a/variables.tf b/variables.tf index 68a0667d..0f4d11af 100644 --- a/variables.tf +++ b/variables.tf @@ -55,12 +55,29 @@ variable "default_table_expiration_ms" { default = null } +variable "default_partition_expiration_ms" { + description = "The default partition expiration for all partitioned tables in the dataset, in msec" + type = number + default = null +} + variable "max_time_travel_hours" { description = "Defines the time travel window in hours" type = number default = null } +variable "storage_billing_model" { + description = "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." + type = string + default = null + + validation { + condition = var.storage_billing_model == null || var.storage_billing_model == "LOGICAL" || var.storage_billing_model == "PHYSICAL" + error_message = "storage_billing_model must be null, \"LOGICAL\" or \"PHYSICAL\"." + } +} + variable "project_id" { description = "Project where the dataset and table are created" type = string