This document explains how to delete Single Message Transforms (SMTs) from an existing Pub/Sub topic.
To delete topic SMTs, you can use the Google Cloud console, the Google Cloud CLI, the client library, or the Pub/Sub API.
Required roles and permissions
To get the permissions that
you need to delete topic SMTs,
ask your administrator to grant you the Pub/Sub Editor
( roles/pubsub.editor
)
IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations
.
This predefined role contains the permissions required to delete topic SMTs. To see the exact permissions that are required, expand the Required permissionssection:
Required permissions
The following permissions are required to delete topic SMTs:
- Grant the update a topic permission on the topic:
projects.topics.patch - Grant the view a topic permission on the project. This permission is only required if you are using the Google Cloud console:
pubsub.topics.view
You might also be able to get these permissions with custom roles or other predefined roles .
You can configure access control at the project level and at the individual resource level.
Delete topic SMTs
To delete topic SMTs, follow these steps:
Console
-
In the Google Cloud console, go to the Pub/Sub Topicspage.
-
Click the topic for which you want to delete an SMT.
-
In the topic details page, click Edit .
The Transforms tab lists all the SMTs that are attached to the topic.
-
Click the delete button for the SMT you would like to delete.
-
Click Update .
gcloud
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
-
This command deletes all SMTs associated with the specified topic.
Run the
gcloud pubsub topics updatecommand with the--clear-message-transformsflag:gcloud pubsub topics update TOPIC_ID --clear-message-transforms
Replace the following:
-
TOPIC_ID : The ID or name of the topic you want to update.
To instead remove a single SMT, refer to Update topic SMTs and create a new
message-transforms-filethat excludes the SMT you wish to delete. -

