professional-cloud-data-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 data engineering team manages cloud data infrastructure—including BigQuery datasets, Cloud Storage buckets, and Dataflow pipelines—across dev and prod environments on Google Cloud. You need to implement a continuous integration and continuous deployment (CI/CD) GitOps workflow using Terraform and Cloud Build that meets the following requirements:
How should you structure your Terraform configuration, state storage, and Cloud Build triggers?
Configure Terraform to run via Cloud Deploy delivery pipelines using Skaffold render stages. Store state in Compute Engine persistent disks, and use Cloud Functions to trigger terraform apply whenever a developer pushes commits to their local workstation branch.
Configure a Cloud Storage backend with separate object prefixes for each environment and enable Object Versioning. Set up Cloud Build triggers to run terraform init and terraform plan on feature branch pull requests as required status checks, and run terraform apply only on merges to the dev and prod branches targeting their respective environment directories.
Store terraform.tfstate files directly within Git feature and environment branches. Configure Cloud Build triggers to execute terraform apply -auto-approve immediately whenever any commit is pushed to a feature branch, and delete the state file after deployment.
Configure a single global Cloud Storage backend prefix without Object Versioning to maintain unified state across all tiers. Configure Cloud Build to run terraform apply simultaneously against both dev and prod directories whenever a pull request is created.
Configure Terraform to run via Cloud Deploy delivery pipelines using Skaffold render stages. Store state in Compute Engine persistent disks, and use Cloud Functions to trigger terraform apply whenever a developer pushes commits to their local workstation branch.
Configure a Cloud Storage backend with separate object prefixes for each environment and enable Object Versioning. Set up Cloud Build triggers to run terraform init and terraform plan on feature branch pull requests as required status checks, and run terraform apply only on merges to the dev and prod branches targeting their respective environment directories.
This solution implements a declarative GitOps pipeline using Cloud Build and Terraform configured with a Cloud Storage (GCS) remote backend across isolated environment branches and directories.
backend "gcs") automatically provides state locking to prevent concurrent modification race conditions. Defining distinct prefixes (e.g., prefix = "env/dev" and prefix = "env/prod") separates environment state files, while enabling Object Versioning on the bucket maintains an audit history and provides recovery points against accidental state corruption.terraform init and terraform plan against environment subfolders. Configuring these builds as required status checks under branch protection rules ensures that syntax errors or unintended infrastructure mutations are caught before code is merged.terraform apply is strictly restricted to pushes/merges onto the designated dev and prod branches. Infrastructure is first tested in dev, and promoting the tested code via a pull request from dev to prod triggers the production terraform apply against the production environment directory.This pattern establishes an automated, repeatable, and secure workflow. It prevents unauthorized live changes, ensures code peer reviews include plan outputs, and cleanly separates environment state without managing complex external orchestrators.
Store terraform.tfstate files directly within Git feature and environment branches. Configure Cloud Build triggers to execute terraform apply -auto-approve immediately whenever any commit is pushed to a feature branch, and delete the state file after deployment.
Configure a single global Cloud Storage backend prefix without Object Versioning to maintain unified state across all tiers. Configure Cloud Build to run terraform apply simultaneously against both dev and prod directories whenever a pull request is created.