HashiCorp Terraform Associate (004) Question 215
Single answer8c Describe how to organize and use HCP Terraform workspaces and projectsA platform team is onboarding HCP Terraform for three application teams. Each application has separate dev, staging, and prod infrastructure, and the company wants clearer visibility and governance without creating separate organizations. The platform team also wants related workspaces grouped logically so stakeholders can filter and review them more easily. Which approach best meets these requirements?
- A
Create one HCP Terraform project per application, and place that application's dev, staging, and prod workspaces inside the same project.
- B
Create one HCP Terraform organization per environment, and use projects only for VCS connections.
- C
Create one workspace per application, and use Terraform Cloud/Enterprise tags instead of projects to represent environments.
- D
Create one project per environment, and put all applications' dev workspaces together, all staging workspaces together, and all prod workspaces together.
Show answer and explanation
Correct answer: A
Explanation
HCP Terraform organizations are the top-level container, and projects are designed to organize workspaces within an organization. A common best practice is to use separate workspaces for separate deployments or environments, such as dev, staging, and prod, because each workspace has its own state, variables, and run history. Projects then provide a logical grouping mechanism for related workspaces, making them useful for organizing by application, team, or business unit depending on the operational model. In this scenario, grouping each application's environment-specific workspaces into a single project best matches the requirement for visibility, governance, and logical organization without creating multiple organizations. This is consistent with HCP Terraform documentation on organizations, projects, and workspace organization patterns.
- A. Correct.
Correct. In HCP Terraform, projects are used to organize related workspaces within a single organization. Creating a project for each application and placing that application's dev, staging, and prod workspaces inside it provides logical grouping, better visibility, and easier governance without requiring multiple organizations. This aligns with the requirement to keep all teams in one organization while grouping related workspaces in a meaningful way.
- B. Incorrect.
Incorrect. Organizations are the top-level boundary in HCP Terraform, but the scenario explicitly says the company does not want to create separate organizations. Also, projects are not used for VCS connections; VCS integration is configured for workspaces, not as the purpose of projects. This option reflects a misunderstanding of the role of organizations versus projects.
- C. Incorrect.
Incorrect. Using a single workspace per application would make it difficult to manage separate dev, staging, and prod states, variables, and runs. Best practice is typically to use separate workspaces for separate environments when they represent distinct deployments. Tags can help with filtering, but they do not replace projects as the primary organizational structure for grouping related workspaces.
- D. Incorrect.
Incorrect. This would group workspaces by environment rather than by application. While that may help some operational views, it does not best satisfy the requirement to keep related workspaces for each application grouped logically for stakeholders. It can also make application-level ownership and review more cumbersome when each application's environments are spread across multiple projects.