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
Question
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)- A81% (26)
- B6% (2)
- C9% (3)
- D3% (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
Community Discussion
No community discussion yet for this question.