Skip to content

Commit 09afb9b

Browse files
authored
Merge pull request #36 from terraform-google-modules/add-table-expiration-bq
Add table expiration, labels and description to BQ dataset
2 parents 56394ac + ac81d2d commit 09afb9b

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Added
10+
- Fields description, labels and default_table_expiration_ms [#36]
11+
912
## [3.0.1] - 2019-XX-YY
1013

1114
### Changed
@@ -64,4 +67,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6467
[#19]: https://github.com/terraform-google-modules/terraform-google-log-export/pull/19
6568
[#18]: https://github.com/terraform-google-modules/terraform-google-log-export/pull/18
6669
[#16]: https://github.com/terraform-google-modules/terraform-google-log-export/pull/16
67-

modules/bigquery/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ so that all dependencies are met.
3737
| Name | Description | Type | Default | Required |
3838
|------|-------------|:----:|:-----:|:-----:|
3939
| dataset\_name | The name of the bigquery dataset to be created and used for log entries matching the filter. | string | n/a | yes |
40+
| default\_table\_expiration\_ms | Default table expiration time (in ms) | string | `"3600000"` | no |
4041
| 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. | string | `"true"` | no |
42+
| description | A use-friendly description of the dataset | string | `"Log export dataset"` | no |
43+
| labels | Dataset labels | map | `<map>` | no |
4144
| location | The location of the storage bucket. | string | `"US"` | no |
4245
| log\_sink\_writer\_identity | The service account that logging uses to write log entries to the destination. (This is available as an output coming from the root module). | string | n/a | yes |
4346
| project\_id | The ID of the project in which the bigquery dataset will be created. | string | n/a | yes |

modules/bigquery/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ resource "google_project_service" "enable_destination_api" {
3939
# Bigquery dataset #
4040
#------------------#
4141
resource "google_bigquery_dataset" "dataset" {
42-
dataset_id = var.dataset_name
43-
project = google_project_service.enable_destination_api.project
44-
location = var.location
45-
delete_contents_on_destroy = var.delete_contents_on_destroy
42+
dataset_id = var.dataset_name
43+
project = google_project_service.enable_destination_api.project
44+
location = var.location
45+
description = var.description
46+
delete_contents_on_destroy = var.delete_contents_on_destroy
47+
default_table_expiration_ms = var.default_table_expiration_ms
48+
labels = var.labels
4649
}
4750

4851
#--------------------------------#
@@ -53,4 +56,3 @@ resource "google_project_iam_member" "bigquery_sink_member" {
5356
role = "roles/bigquery.dataEditor"
5457
member = var.log_sink_writer_identity
5558
}
56-

modules/bigquery/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,18 @@ variable "delete_contents_on_destroy" {
3636
default = "true"
3737
}
3838

39+
variable "default_table_expiration_ms" {
40+
description = "Default table expiration time (in ms)"
41+
default = 3600000
42+
}
43+
44+
variable "description" {
45+
description = "A use-friendly description of the dataset"
46+
default = "Log export dataset"
47+
}
48+
49+
variable "labels" {
50+
description = "Dataset labels"
51+
type = map
52+
default = {}
53+
}

0 commit comments

Comments
 (0)