Skip to content

Conversation

fbtravi
Copy link

@fbtravi fbtravi commented Aug 29, 2025

Previously, the subscription_labels variable applied mandatory labels to all subscriptions.
This PR introduces per-subscription labels by adding an optional labels field inside each subscription.

  • Global labels (subscription_labels) continue to be applied to all subscriptions.
  • Subscription-specific labels can now be set and are merged with the global defaults.
  • Subscription-specific labels override global labels in case of conflicts.

This change is backwards-compatible and does not break previous configurations.

module "pubsub" {
  source  = "terraform-google-modules/pubsub/google"
  version = "~> 7.0"

  project_id           = var.project_id
  create_topic         = false
  create_subscriptions = true
  topic                = google_pubsub_topic.example.id
  subscription_labels = { env = "dev" }

  pull_subscriptions = [
    {
      name                 = "pull"
      ack_deadline_seconds = 10
      labels = {  feature = "billing"  }
    },
  ]

  push_subscriptions = [
    {
      name                 = "push"
      push_endpoint        = "https://${var.project_id}.appspot.com/"
      x-goog-version       = "v1beta1"
      ack_deadline_seconds = 20
      expiration_policy    = "1209600s" // two weeks
    },
  ]

}

@fbtravi fbtravi requested review from a team, ayushmjain, imrannayer and q2w as code owners August 29, 2025 20:32
@fbtravi
Copy link
Author

fbtravi commented Sep 23, 2025

Hello, sorry for the new message, but this is very important for the organization I intend to set up.
We will have a project with almost 150 topics, and using the labels this way will help a lot with organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant