Google ACE Deploying and Implementing a Cloud Solution Practice Question
A Cloud Function needs to be triggered whenever a message is published to a Pub/Sub topic. Which 'gcloud functions deploy' command flag is required to set the trigger?
⚠ Common exam trap
ACE often tests the difference between --trigger-topic (Pub/Sub), --trigger-bucket (Cloud Storage), and --trigger-event (generic events) — candidates who haven't deployed Pub/Sub functions may pick --trigger-event by mistake.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
--trigger-topic
For a Cloud Function triggered by Pub/Sub messages, the required flag is --trigger-topic, which specifies the Pub/Sub topic name. This flag automatically wires the function as a subscriber to that topic and sets the correct event type.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
--trigger-topic
Why this is correct
This flag directly associates the Cloud Function with a Pub/Sub topic. When a message is published to that topic, Pub/Sub delivers it as an event to the function, which is how you configure a message-triggered function. Unlike other triggers, this is the standard and only appropriate flag for Pub/Sub message events in the gcloud beta functions deploy command. It ensures the function is invoked asynchronously with the message payload as the event data.
- ✗
--trigger-http
Why it's wrong here
This flag creates an HTTP endpoint that responds to requests, not Pub/Sub messages. While HTTP triggers can receive JSON payloads via POST, they require an external HTTP client to invoke and don't listen to Pub/Sub topics. Using this flag would cause the function to be invoked by HTTPS requests only, not by messages published to a topic, so it fails the requirement.
- ✗
--trigger-event
Why it's wrong here
This flag is actually used to specify the event type for Cloud Storage triggers, like google.storage.object.finalize, and is used in conjunction with --trigger-resource. It does not configure Pub/Sub subscriptions. For Pub/Sub, the topic itself implies the event type, so specifying --trigger-event would be incorrect and would likely cause a deployment error.
- ✗
--trigger-bucket
Why it's wrong here
There is no such gcloud flag. Cloud Storage triggers are set up using --trigger-resource for the bucket name and --trigger-event for the storage event type. Since --trigger-bucket doesn't exist in the gcloud SDK, it cannot be used to deploy a function, and it certainly wouldn't handle Pub/Sub message triggers.
Go deeper
Related to this question
About these practice questions
This ACE question is part of Courseiva's 775-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Google Cloud exam blueprint
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.