Skip to content

Commit ff4dd7c

Browse files
committed
Fix the dataset tag
1 parent 3f74bb6 commit ff4dd7c

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ module "bigquery" {
3535
project_id = "<PROJECT ID>"
3636
location = "US"
3737
default_table_expiration_ms = 3600000
38-
tag_key = "56789"
39-
tag_value = "production"
38+
resource_tags = {"<PROJECT>/<TAG KEY>":"<TAG VALUE>"}
4039
4140
tables = [
4241
{

main.tf

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ locals {
2828
}
2929
}
3030

31-
data "google_tags_tag_value" "tag_value" {
32-
count = var.tag_key != "" && var.tag_value != "" ? 1 : 0
33-
parent = "tagKeys/${var.tag_key}"
34-
short_name = var.tag_value
35-
}
36-
3731
resource "google_bigquery_dataset" "main" {
3832
dataset_id = var.dataset_id
3933
friendly_name = var.dataset_name
@@ -44,14 +38,7 @@ resource "google_bigquery_dataset" "main" {
4438
max_time_travel_hours = var.max_time_travel_hours
4539
project = var.project_id
4640
labels = var.dataset_labels
47-
48-
dynamic "resource_tags" {
49-
for_each = var.tag_key != "" && var.tag_value != "" ? [1] : []
50-
content {
51-
key = data.google_tags_tag_value.tag_value[0].parent
52-
value = data.google_tags_tag_value.tag_value[0].id
53-
}
54-
}
41+
resource_tags = var.resource_tags
5542

5643
dynamic "default_encryption_configuration" {
5744
for_each = var.encryption_key == null ? [] : [var.encryption_key]

variables.tf

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,11 @@ variable "dataset_labels" {
7777
type = map(string)
7878
default = {}
7979
}
80-
variable "tag_key" {
81-
description = "The ID of the parent TagKey"
82-
type = string
83-
default = ""
84-
}
8580

86-
variable "tag_value" {
87-
description = "The short name of the TagValue"
88-
type = string
89-
default = ""
81+
variable "resource_tags" {
82+
description = "A map of resource tags to add to the dataset"
83+
type = map(string)
84+
default = {}
9085
}
9186

9287
# Format: list(objects)

0 commit comments

Comments
 (0)