Skip to content

Commit fd4df52

Browse files
fix: Add dependency on the Pub/Sub topic/subscription for tags examples (#15589) (#1152)
[upstream:e557ee7da06142d40585af6d3457d210190e26f9] Signed-off-by: Modular Magician <[email protected]>
1 parent bbc8e86 commit fd4df52

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pubsub_subscription_tags/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ data "google_project" "project" {}
1515
resource "google_tags_tag_key" "tag_key" {
1616
parent = data.google_project.project.id
1717
short_name = "tag_key-${local.name_suffix}"
18+
depends_on = [google_pubsub_topic.example]
1819
}
1920

2021
resource "google_tags_tag_value" "tag_value" {

pubsub_topic_tags/main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
resource "google_pubsub_topic" "example" {
22
name = "example-topic-${local.name_suffix}"
3-
tags = {
4-
(google_tags_tag_key.tag_key.namespaced_name) = google_tags_tag_value.tag_value.short_name
5-
}
3+
project = data.google_project.project.project_id
64
}
75

86
data "google_project" "project" {}
@@ -16,3 +14,8 @@ resource "google_tags_tag_value" "tag_value" {
1614
parent = google_tags_tag_key.tag_key.id
1715
short_name = "tag_value-${local.name_suffix}"
1816
}
17+
18+
resource "google_tags_tag_binding" "binding" {
19+
parent = "//pubsub.googleapis.com/projects/${data.google_project.project.number}/topics/${google_pubsub_topic.example.name}"
20+
tag_value = google_tags_tag_value.tag_value.id
21+
}

0 commit comments

Comments
 (0)