nerdexam
Google

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #162

You are designing a system with three different environments: development, quality assurance (QA), and production. Each environment will be deployed with Terraform and has a Google Kubernetes Engine (

The correct answer is A. Cloud Infrastructure (Terraform) repository is shared: different directories are different. The GitOps best practice for multi-environment Terraform infrastructure is to use a single shared repository with separate directories per environment (e.g., /dev, /qa, /prod). Directory-based separation allows each environment's configuration to evolve independently with clear b

Submitted by chiamaka_o· Apr 18, 2026Building and implementing CI/CD pipelines for a service

Question

You are designing a system with three different environments: development, quality assurance (QA), and production. Each environment will be deployed with Terraform and has a Google Kubernetes Engine (GKE) cluster created so that application teams can deploy their applications. Anthos Config Management will be used and templated to deploy infrastructure level resources in each GKE cluster. All users (for example, infrastructure operators and application owners) will use GitOps. How should you structure your source control repositories for both Infrastructure as Code (IaC) and application code?

Options

  • ACloud Infrastructure (Terraform) repository is shared: different directories are different
  • BCloud Infrastructure (Terraform) repository is shared: different directories are different
  • CCloud Infrastructure (Terraform) repository is shared: different branches are different
  • DCloud Infrastructure (Terraform) repositories are separated: different branches are different

How the community answered

(32 responses)
  • A
    81% (26)
  • B
    6% (2)
  • C
    9% (3)
  • D
    3% (1)

Explanation

The GitOps best practice for multi-environment Terraform infrastructure is to use a single shared repository with separate directories per environment (e.g., /dev, /qa, /prod). Directory-based separation allows each environment's configuration to evolve independently with clear boundaries, enables targeted CI/CD pipelines per directory, and avoids the complexity of branch-based merges across environments. Branch-based environment separation (options C and D) creates merge complexity and risks configuration drift between long-lived branches. A single directory structure with shared branches does not provide the isolation needed for independent environment management. Separate repositories per environment (option D) increases operational overhead and makes shared module management more difficult.

Topics

#Source Control Management#GitOps#Infrastructure as Code (IaC)#Multi-environment Deployment

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Practice