GCP Pub/Sub Topic resource inventory

Maintain Pub/Sub topic and subscription relationships, permissions and message-protection policies.

Description

This entry lists a Pub/Sub topic. Pub/Sub encrypts stored messages by default.

Potential impact

An overlooked topic can fall outside access and message-retention reviews.

Remediation

Record the owner and connected subscriptions. Check who can publish to the topic, who can receive messages from each subscription and how long messages are kept.

Examples

These excerpts use the retired Deployment Manager format. The first uses default encryption. The second sets kmsKeyName on classified-topic. Supply a customer-managed key and grant the Pub/Sub service agent permission to use it.

Before

yaml
resources:
  - type: pubsub.v1.topic
    name: topic-1
    properties:
      topic: classified-topic

After

yaml
resources:
  - type: pubsub.v1.topic
    name: topic-1
    properties:
      topic: classified-topic
      kmsKeyName: projects/example/locations/global/keyRings/ring/cryptoKeys/key

Keep the key available so Pub/Sub can continue processing messages.

References