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.
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?
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.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.