Skip to content

Commit 9983385

Browse files
committed
add storage_billing_model + docs
1 parent a9e9cde commit 9983385

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ This module provisions a dataset and a list of tables with associated JSON schem
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 |
206206
| 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 |
207+
| 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 | `string` | `null` | 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

209210
## Outputs

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +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
7269
- name: default_partition_expiration_ms
7370
description: The default partition expiration for all partitioned tables in the dataset, in MS
7471
varType: number
@@ -227,6 +224,9 @@ spec:
227224
})),
228225
}))
229226
defaultValue: []
227+
- name: storage_billing_model
228+
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
229+
varType: string
230230
outputs:
231231
- name: bigquery_dataset
232232
description: Bigquery dataset resource.

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)