Professional Cloud DevOps Engineer
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.
Last updated
Your enterprise DevOps team needs to implement an automated ephemeral environment strategy for feature branch testing on Google Cloud. Every time a developer opens a pull request (PR), an isolated environment containing dedicated Google Kubernetes Engine (GKE) workloads and supporting Google Cloud resources (such as Cloud Storage buckets and service accounts) must be created on-demand. The solution must ensure secure state isolation, prevent resource naming collisions across concurrent PRs, execute integration test suites, and automatically tear down all provisioned resources when the PR is closed or merged.
How should you architect this pipeline to meet these requirements?
Configure Cloud Build triggers listening to PR events that invoke Terraform using dynamic state prefixes in Cloud Storage for environment provisioning, and configure an automated PR closure trigger to execute a destruction pipeline.
Deploy a permanent, multi-tenant GKE cluster with manual namespace assignments and execute non-declarative shell scripts in Cloud Build to provision GCP backend resources directly via gcloud commands.
Create a scheduled Cloud Scheduler job that runs an hourly Cloud Build pipeline executing Terraform across all active Git branches using a single shared default workspace.
Use Cloud Composer to trigger Google Cloud Deployment Manager to provision a brand new Google Cloud Organization folder and standalone billing account per pull request.
Configure Cloud Build triggers listening to PR events that invoke Terraform using dynamic state prefixes in Cloud Storage for environment provisioning, and configure an automated PR closure trigger to execute a destruction pipeline.
This architecture leverages Cloud Build triggers integrated with source repository events (such as pull request opening, synchronizing, and closing) alongside modular Terraform configurations that utilize dynamic state key paths in a centralized Cloud Storage (GCS) backend.
terraform apply when a PR is opened or updated, passing unique branch/PR identifiers (e.g., pr-${_PR_NUMBER}) to parameterize resource names and deploy workloads to isolated GKE namespaces.terraform init -backend-config="prefix=env/pr-${_PR_NUMBER}") ensures that concurrent branch builds maintain completely independent state files without locking or overwriting each other.terraform destroy pointing to the exact same dynamic state path, guaranteeing complete resource destruction and preventing cloud spend leakage.Dynamic Terraform state management combined with native Git webhook triggers in Cloud Build provides a fully declarative, event-driven, and cost-effective lifecycle for isolated preview environments without manual operational overhead.
Deploy a permanent, multi-tenant GKE cluster with manual namespace assignments and execute non-declarative shell scripts in Cloud Build to provision GCP backend resources directly via gcloud commands.
Create a scheduled Cloud Scheduler job that runs an hourly Cloud Build pipeline executing Terraform across all active Git branches using a single shared default workspace.
Use Cloud Composer to trigger Google Cloud Deployment Manager to provision a brand new Google Cloud Organization folder and standalone billing account per pull request.