Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add dataset_create flag to skip creation if already exists #48

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/slo-pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ See the [fixture project](../../test/setup/main.tf) for an example to create thi

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| dataset\_create | Whether to create the BigQuery dataset | bool | `"true"` | no |
| dataset\_default\_table\_expiration\_ms | The default lifetime of the slo table in the dataset, in milliseconds. Default is never (Recommended) | number | `"-1"` | no |
| exporters | SLO export destinations config | list(any) | n/a | yes |
| function\_bucket\_name | Name of the bucket to create to store the Cloud Function code | string | `"slo-pipeline"` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/slo-pipeline/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "local_file" "exporters" {
}

resource "google_bigquery_dataset" "main" {
count = length(local.bigquery_configs)
count = var.dataset_create == false ? 0 : length(local.bigquery_configs)
project = local.bigquery_configs[count.index].project_id
dataset_id = local.bigquery_configs[count.index].dataset_id
delete_contents_on_destroy = lookup(local.bigquery_configs[count.index], "delete_contents_on_destroy", false)
Expand Down
6 changes: 6 additions & 0 deletions modules/slo-pipeline/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ variable "dataset_default_table_expiration_ms" {
default = -1 # no expiration
}

variable "dataset_create" {
type = bool
description = "Whether to create the BigQuery dataset"
default = true
}

variable "slo_generator_version" {
description = "SLO generator library version"
default = "1.1.2"
Expand Down