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

Fix issue with GKE cluster notifications topic & static output for pubsub module #1205

Merged
merged 1 commit into from
Mar 2, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,11 @@ resource "google_compute_network_peering_routes_config" "gke_master" {

resource "google_pubsub_topic" "notifications" {
count = (
try(var.enable_features.upgrade_notifications.topic_id, null) == null ? 0 : 1
try(var.enable_features.upgrade_notifications, null) != null &&
try(var.enable_features.upgrade_notifications.topic_id, null) == null ? 1 : 0
)
name = "gke-pubsub-notifications"
project = var.project_id
name = "gke-pubsub-notifications"
labels = {
content = "gke-notifications"
}
Expand Down
10 changes: 5 additions & 5 deletions modules/pubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ module "pubsub" {
| name | description | sensitive |
|---|---|:---:|
| [id](outputs.tf#L17) | Topic id. | |
| [schema](outputs.tf#L25) | Schema resource. | |
| [schema_id](outputs.tf#L30) | Schema resource id. | |
| [subscription_id](outputs.tf#L35) | Subscription ids. | |
| [subscriptions](outputs.tf#L45) | Subscription resources. | |
| [topic](outputs.tf#L53) | Topic resource. | |
| [schema](outputs.tf#L26) | Schema resource. | |
| [schema_id](outputs.tf#L31) | Schema resource id. | |
| [subscription_id](outputs.tf#L36) | Subscription ids. | |
| [subscriptions](outputs.tf#L46) | Subscription resources. | |
| [topic](outputs.tf#L54) | Topic resource. | |

<!-- END TFDOC -->
1 change: 1 addition & 0 deletions modules/pubsub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ locals {
options = try(v.options, v, null) == null ? var.defaults : v.options
}
}
topic_id_static = "projects/${var.project_id}/topics/${var.name}"
}

resource "google_pubsub_schema" "default" {
Expand Down
3 changes: 2 additions & 1 deletion modules/pubsub/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

output "id" {
description = "Topic id."
value = google_pubsub_topic.default.id
value = local.topic_id_static
depends_on = [
google_pubsub_topic.default,
google_pubsub_topic_iam_binding.default
]
}
Expand Down