Skip to main content

google_pubsub_topic resource


A google_pubsub_topic is used to test a Google Topic resource


describe google_pubsub_topic(project: 'chef-gcp-inspec', name: 'inspec-gcp-topic') do
  it { should exist }

describe google_pubsub_topic(project: 'chef-gcp-inspec', name: 'nonexistent') do
  it { should_not exist }


Properties that can be accessed from the google_pubsub_topic resource:

Name of the topic.
The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project’s PubSub service account (service-{{PROJECT_NUMBER}} must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
A set of key/value label pairs to assign to this Topic.
Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect.
A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.

GCP Permissions

Ensure the Cloud Pub/Sub API is enabled for the current project.