HCP Terraform and Remote Collaboration
A remote backend solves an important problem: shared state. CI/CD solves another: repeatable execution. But once a team wants centralized runs, permissions, state, variables, VCS integration, and collaboration around those runs, it is useful to have a platform that brings those pieces together.
That is the role HCP Terraform.
What Is HCP Terraform?
HCP Terraform is HashiCorp’s managed platform for collaborative Terraform workflows.
Terraform itself is still the infrastructure-as-code engine.
HCP Terraform adds an operational platform around it.
A useful distinction is:
Terraform
β
βββ infrastructure-as-code engine
HCP Terraform
β
βββ state
βββ runs
βββ workspaces
βββ variables
βββ permissions
βββ VCS integration
βββ collaborationHCP Terraform workspaces represent managed collections of infrastructure and can store state, variables, runs, and access-control settings. Remote execution can run Terraform on HCP Terraform’s disposable infrastructure.
HCP Terraform is therefore not a replacement for the Terraform language or CLI.
It is a managed way to operate Terraform.
Terraform CLI Versus HCP Terraform
With the CLI alone, you might have:
Developer laptop
β
βΌ
Terraform CLI
β
βΌ
S3 backend
β
βΌ
InfrastructureWith HCP Terraform:
Developer / Git
β
βΌ
HCP Terraform
β
βββ State
βββ Runs
βββ Variables
βββ Permissions
βββ Terraform execution
β
βΌ
InfrastructureThe important change is where the operational control lives.
Instead of each engineer deciding how to execute Terraform, HCP Terraform provides a centralized system for managing runs and access.
HCP Terraform Workspaces
Do not confuse HCP Terraform workspaces with Terraform CLI workspaces.
A CLI workspace isolates multiple state files within one local Terraform working directory.
An HCP Terraform workspace is a managed infrastructure collection.
HashiCorp describes HCP Terraform workspaces as required for managing infrastructure in HCP Terraform. They also form a major part of the service’s permissions model.
A conceptual example:
HCP Terraform Organization
β
βββ development-network
βββ staging-network
βββ production-network
βββ development-application
βββ production-applicationEach workspace has its own state.
Remote State
Each HCP Terraform workspace has separate state data.
In remote execution mode, HCP Terraform automatically configures Terraform to use the workspace’s state, so you do not need to configure a traditional backend in the same way you would for S3.
This gives you:
Workspace
β
βββ Configuration
βββ Variables
βββ State
βββ Runs
βββ PermissionsThat grouping is one of the major reasons HCP Terraform can simplify team operations.
Remote Execution
With local Terraform:
Your laptop
β
βββ Terraform binary
βββ provider plugins
βββ credentials
βββ executionWith remote execution:
Your laptop / Git
β
βΌ
HCP Terraform
β
βΌ
Disposable execution environment
β
βΌ
Cloud providerFor workspaces using remote execution, HCP Terraform performs Terraform runs on its own disposable virtual machines. That provides a consistent execution environment. It also means the laptop is no longer the machine that actually performs the production apply.
The Collaboration Workflow
A common workflow looks like:
Git Repository
β
βΌ
HCP Terraform
β
ββββββ΄βββββ
βΌ βΌ
Plan State
β
βΌ
Review
β
βΌ
Approval
β
βΌ
Apply
β
βΌ
InfrastructureThis changes the experience for the team.
A developer can create a pull request.
HCP Terraform can create a run associated with the change.
The team can inspect the plan.
An authorized person can approve the run.
The apply happens in the controlled execution environment.
The state remains associated with the workspace.
VCS Integration
HCP Terraform workspaces can connect to version-control repositories containing Terraform configuration.
Conceptually:
Developer
β
βΌ
Git Push
β
βΌ
VCS Repository
β
βΌ
HCP Terraform Workspace
β
βΌ
Terraform PlanThis means the Git repository remains the source of Terraform configuration while HCP Terraform becomes the execution and collaboration layer.
That is an important separation.
Git
β
βββ "What code should run?"
HCP Terraform
β
βββ "How and by whom should it run?"
State
β
βββ "What does Terraform currently manage?"Variables and Variable Sets
Terraform needs variables.
In a local workflow, you might use:
terraform.tfvars
TF_VAR_...In HCP Terraform, variables can be associated with workspaces and organizations can use variable sets to share common variables across multiple workspaces.
This is particularly useful when several workspaces share configuration such as:
AWS region
Common tags
Organization-specific settings
Provider authentication inputsVariable sets reduce repetition.
But shared variables should not become a dumping ground.
The same least-privilege principle applies to secrets and credentials.
Permissions and Teams
A production Terraform system needs more than “everyone can apply.”
HCP Terraform provides teams and workspace-level access controls.
Teams can be given different levels of access to workspaces, including roles such as:
Read
Plan
Write
Adminand more granular permissions are available.
A conceptual organizational model might be:
Platform Team
β
βββ Admin production networking
βββ Admin shared infrastructure
Application Team
β
βββ Plan production application
βββ Write development application
Developers
β
βββ Read productionThe exact permissions should match your organization.
The principle is:
Permissions should follow responsibility.
Projects and Workspace Organization
As an organization grows, you may have many workspaces.
HCP Terraform provides projects for grouping workspaces and scoping permissions.
For example:
Projects
β
βββ Platform
β βββ production-network
β βββ shared-services
β
βββ Payments
β βββ production
β βββ staging
β
βββ Internal Tools
βββ production
βββ developmentThis can make ownership and access boundaries easier to reason about.
Run History
A manually executed Terraform command leaves much of the operational context on the machine that ran it.
A centralized service can provide a history of runs:
Run 104
β
βββ configuration version
βββ plan
βββ approval
βββ apply
βββ result
Run 105
β
βββ ...This helps answer questions such as:
- What changed?
- Which run applied it?
- When did it happen?
- What was the plan?
- Who approved the operation?
- Did it succeed?
Auditability is one of the biggest benefits of centralized Terraform operations.
Private Module Registry
Teams often build reusable Terraform modules.
Earlier in the course, you learned that modules can come from different sources.
HCP Terraform also provides a private module registry for organizations.
That gives a team a controlled place to publish and consume reusable internal modules.
Conceptually:
Platform Team
β
βΌ
Private Module Registry
β
βββββ΄βββββ
βΌ βΌ
App A App BThis can help standardize infrastructure patterns without forcing every team to copy module source into its own repository.
Remote State Sharing
Sometimes one Terraform configuration needs information managed by another.
HCP Terraform supports controlled state sharing between workspaces. Its configuration can restrict which workspaces are allowed to access another workspace’s state.
That creates a useful boundary:
Network Workspace
β
β selected outputs
βΌ
Application WorkspaceRather than giving every workspace unrestricted access to every other workspace’s state, access can be deliberately scoped.
Remember that state can contain sensitive information.
State sharing is therefore an access-control decision, not just a convenience feature.
Remote Versus Local Execution
HCP Terraform supports different execution modes.
The important conceptual distinction is:
Remote
HCP Terraform performs the Terraform operations.
HCP Terraform
β
βββ Terraform runLocal
Your machine performs the Terraform operations while HCP Terraform can still provide state storage and related services.
Agent
An HCP Terraform agent can execute runs in infrastructure you control, which is useful when Terraform needs access to private networks or isolated infrastructure.
Current HCP Terraform documentation identifies Remote, Local, and Agent execution modes.
The choice depends on where Terraform needs to run and what network or operational constraints exist.
HCP Terraform Does Not Remove Terraform Concepts
It is easy to think:
“If I use HCP Terraform, I don’t need to understand state, plans, providers, or Terraform CLI behavior.”
That is backwards.
HCP Terraform makes those concepts more operationally manageable.
You still need to understand:
- Terraform configuration
- State
- Providers
- Resources
- Modules
- Plans
- Applies
- Dependencies
- Authentication
- Permissions
The platform does not remove Terraform’s execution model.
It organizes it.
HCP Terraform Versus S3 + CI
You do not automatically need HCP Terraform.
A team can build a strong workflow with:
Git
+
CI/CD
+
S3 backend
+
S3 locking
+
IAMThat can be a perfectly reasonable architecture.
HCP Terraform becomes attractive when you want more of the collaboration layer managed for you:
S3 + CI
β
βββ You assemble the pieces
βββ You maintain CI workflows
βββ You manage state infrastructure
βββ You build approval conventions
HCP Terraform
β
βββ Managed state
βββ Managed runs
βββ Workspace permissions
βββ VCS integration
βββ Variable management
βββ Collaboration UIThe trade-off is that you are adopting a managed platform and its operational model.
A Complete Mental Model for Team Terraform
At the end of this section, think of the entire system as several cooperating layers:
Git
β
Terraform Code
β
βΌ
Execution System
βββββββββ΄βββββββββ
β β
CI/CD HCP Terraform
β β
βββββββββ¬βββββββββ
βΌ
Terraform Run
β
βΌ
Remote State
β
ββββββββ΄βββββββ
βΌ βΌ
Locking Access Control
β β
ββββββββ¬βββββββ
βΌ
Cloud Provider
β
βΌ
InfrastructureEach layer solves a different problem.
Git manages configuration history.
Terraform describes and changes infrastructure.
The backend or HCP Terraform manages state.
Locking coordinates concurrent writers.
CI/CD or HCP Terraform controls execution.
IAM and platform permissions control who can perform operations.
The cloud provider hosts the actual infrastructure.
The Core Lesson of Team Terraform
Terraform changes character when the only person running it is no longer you.
A local workflow can look like:
Edit
β
βΌ
terraform apply
β
βΌ
InfrastructureA team workflow looks more like:
Configuration
β
βΌ
Git
β
βΌ
Review
β
βΌ
Plan
β
βΌ
Approval
β
βΌ
Controlled Apply
β
βΌ
Shared State
β
βΌ
InfrastructureThe additional machinery is not bureaucracy for its own sake.
It exists because infrastructure has become shared.
A shared state file needs protection.
A production change needs coordination.
A cloud credential needs controlled access.
A plan needs review.
An apply needs an accountable execution path.
That is the central idea behind team Terraform.
Section 4 Complete
You started this section with Terraform running on a laptop:
Terraform on my laptopYou can now reason about the complete team-oriented model:
Git
β
Configuration
β
βΌ
Terraform Execution
β
ββββββββββ΄βββββββββ
βΌ βΌ
Plan/Review Credentials
β β
ββββββββββ¬βββββββββ
βΌ
Remote Backend
β
βββββββ΄ββββββ
βΌ βΌ
State Locking
β
βΌ
Cloud InfrastructureAnd, when a managed collaboration platform is appropriate:
Git
β
βΌ
HCP Terraform
β
βββ Workspaces
βββ State
βββ Runs
βββ Variables
βββ Permissions
βββ Remote Execution
β
βΌ
InfrastructureTerraform itself did not become a different language.
The surrounding operational system became more disciplined.
That is what makes Terraform suitable for teams: not merely reusable configuration, but controlled state, coordinated changes, protected credentials, reviewable plans, and accountable execution.