Skip to content

Commit 516370c

Browse files
committed
add storage_billing_model + docs
1 parent 533abb2 commit 516370c

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ This module provisions a dataset and a list of tables with associated JSON schem
190190
| dataset\_id | Unique ID for the dataset being provisioned. | `string` | n/a | yes |
191191
| dataset\_labels | Key value pairs in a map for dataset labels | `map(string)` | `{}` | no |
192192
| dataset\_name | Friendly name for the dataset being provisioned. | `string` | `null` | no |
193-
| default\_table\_expiration\_ms | TTL of tables using the dataset in MS | `number` | `null` | no |
194193
| default\_partition\_expiration\_ms | The default partition expiration for all partitioned tables in the dataset, in MS | `number` | `null` | no |
194+
| default\_table\_expiration\_ms | TTL of tables using the dataset in MS | `number` | `null` | no |
195195
| 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 |
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 |
@@ -203,6 +203,7 @@ This module provisions a dataset and a list of tables with associated JSON schem
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 |
205205
| 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 |
206+
| 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 |
206207
| 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 |
207208
| 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 |
208209

main.tf

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,18 @@ locals {
2929
}
3030

3131
resource "google_bigquery_dataset" "main" {
32-
dataset_id = var.dataset_id
33-
friendly_name = var.dataset_name
34-
description = var.description
35-
location = var.location
36-
delete_contents_on_destroy = var.delete_contents_on_destroy
37-
default_table_expiration_ms = var.default_table_expiration_ms
38-
max_time_travel_hours = var.max_time_travel_hours
39-
project = var.project_id
40-
labels = var.dataset_labels
41-
resource_tags = var.resource_tags
4232
dataset_id = var.dataset_id
4333
friendly_name = var.dataset_name
4434
description = var.description
4535
location = var.location
4636
delete_contents_on_destroy = var.delete_contents_on_destroy
4737
default_table_expiration_ms = var.default_table_expiration_ms
48-
default_partition_expiration_ms = var.default_partition_expiration_ms
4938
max_time_travel_hours = var.max_time_travel_hours
5039
storage_billing_model = var.storage_billing_model
5140
project = var.project_id
5241
labels = var.dataset_labels
42+
resource_tags = var.resource_tags
43+
default_partition_expiration_ms = var.default_partition_expiration_ms
5344

5445
dynamic "default_encryption_configuration" {
5546
for_each = var.encryption_key == null ? [] : [var.encryption_key]

metadata.display.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ spec:
3939
dataset_name:
4040
name: dataset_name
4141
title: Dataset Name
42-
default_table_expiration_ms:
43-
name: default_table_expiration_ms
44-
title: Default Table Expiration Ms
4542
default_partition_expiration_ms:
4643
name: default_partition_expiration_ms
4744
title: Default Partition Expiration Ms
45+
default_table_expiration_ms:
46+
name: default_table_expiration_ms
47+
title: Default Table Expiration Ms
4848
delete_contents_on_destroy:
4949
name: delete_contents_on_destroy
5050
title: Delete Contents On Destroy
@@ -78,6 +78,9 @@ spec:
7878
routines:
7979
name: routines
8080
title: Routines
81+
storage_billing_model:
82+
name: storage_billing_model
83+
title: Storage Billing Model
8184
tables:
8285
name: tables
8386
title: Tables

metadata.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ spec:
6666
description: The regional location for the dataset only US and EU are allowed in module
6767
varType: string
6868
defaultValue: US
69-
- name: default_table_expiration_ms
70-
description: TTL of tables using the dataset in MS
71-
varType: number
72-
- name: default_partition_expiration_ms
73-
description: The default partition expiration for all partitioned tables in the dataset, in MS
74-
varType: number
7569
- name: delete_contents_on_destroy
7670
description: (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.
7771
varType: bool
@@ -82,9 +76,15 @@ spec:
8276
- name: default_table_expiration_ms
8377
description: TTL of tables using the dataset in MS
8478
varType: number
79+
- name: default_partition_expiration_ms
80+
description: The default partition expiration for all partitioned tables in the dataset, in MS
81+
varType: number
8582
- name: max_time_travel_hours
8683
description: Defines the time travel window in hours
8784
varType: number
85+
- name: storage_billing_model
86+
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.
87+
varType: string
8888
- name: project_id
8989
description: Project where the dataset and table are created
9090
varType: string

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ variable "max_time_travel_hours" {
6767
default = null
6868
}
6969

70+
variable "storage_billing_model" {
71+
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."
72+
type = string
73+
default = null
74+
75+
validation {
76+
condition = var.storage_billing_model == null || var.storage_billing_model == "LOGICAL" || var.storage_billing_model == "PHYSICAL"
77+
error_message = "storage_billing_model must be null, \"LOGICAL\" or \"PHYSICAL\"."
78+
}
79+
}
80+
7081
variable "project_id" {
7182
description = "Project where the dataset and table are created"
7283
type = string

0 commit comments

Comments
 (0)