HCP Terraform (HashiCorp Cloud Platform Terraform) is a cloud-based service for managing Terraform deployments
in secure and collaborative environment.
It provides:
- Remote execution - Terraform runs in secure cloud environment.
- Remote state storage - shared, versioned, encrypted.
- State locking - prevents concurrent modifications in team settings.
- Run history.
- Audit logging.
- Policy enforcement with Sentinel or OPA.
- Private registry for sharing modules and providers.
- Integration with version control systems (VCS).
- Workspaces - isolate environments.
- Cost estimation - preview cloud costs before apply.
- Integration with security, compliance, and validation tools.
- Automated drift detection.
HCP Terraform is available in several tiers or plans - Free, Essentials, Standard, Premium, and Enterprise (Self-Managed)
which mainly differ by pricing, scalability, governance, and collaboration features.
While all plans support core Terraform functionality (e.g., remote runs, state management, and VCS integration),
advanced capabilities like team-based access control, policy enforcement (Sentinel), audit logging, and larger
resource limits are only available in higher-tier or Enterprise plans.
In HCP Terraform, there are two main ways of organizing infrastructure:
- Workspaces - for managing a self-contained infrastructure of one Terraform root module.
- Stacks - for managing multiple infrastructure modules and repeating that infrastructure at scale.
A workspace contains:
- one Terraform root module (Terraform configuration),
- one set of input and environment variables,
- one state file.
Projects organize workspaces into groups.
Every workspace must belong to exactly one project. By default, all workspaces belong to an organization's
Default Project. The default project can be renamed, but cannot be deleted.
A workspace is assigned to a project at the time of creation and can be moved to a different project at any time.
Note: HCP Terraform workspaces and Terraform CLI workspaces function differently.
Terraform CLI workspaces are associated with a specific working directory and isolate multiple state files
in the same working directory, allowing to manage multiple groups of resources or environments with a single
configuration.
Workspace Variables
HCP Terraform workspace variables store configuration values used during Terraform runs.
Common use cases include defining environment-specific inputs, setting static credentials, or securely managing
dynamic provider credentials.
There are two types of HCP Terraform variables: environment variables and Terraform variables (also known as
input variables).
Variables can be set specifically for each workspace or groupped into variable sets to share the same
variables across multiple workspaces. Each environment and Terraform variable can have one of the following
scopes:
- Workspace run-specific - Applies to a specific run within a single workspace.
- Workspace-Specific - Applies to a single workspace.
- Workspace-Scoped Variable Set - Applies to multiple workspaces within the same organization.
- Project-Scoped Variable Set - Automatically applied and available to all current and future
workspaces and stacks within a project.
- Global Variable Set - Automatically applied to all current and future workspaces and stacks
within an organization.
Workflows
HCP Terraform supports the following workflows:
- VCS-driven workflow: HCP Terraform fetches your configuration from your version control repository
and automatically starts plan and apply operations whenever you make changes to the repository. This keeps
your repository as the single source of truth for the workspace.
- CLI-driven workflow: Use your local Terraform CLI to start remote operations in HCP Terraform.
HCP Terraform runs the operation and manages the state file.
- API-driven workflow: Use the HCP Terraform API to upload Terraform configuration changes and manage
Terraform operations.
Execution Modes
HCP Terraform supports the following execution modes:
- Organization Default: Uses the organization's execution mode. This is either Remote or Local.
- Remote: Plan and apply operations run on HCP Terraform's or Terraform Enterprise's infrastructure.
You and your team have the ability to review and collaborate on runs within the application.
- Local: Plan and apply operations run on machines that you control. HCP Terraform and Terraform
Enterprise only store and synchronize state.
- Agent: Plan and apply operations that your agent executes are managed by HCP Terraform or Terraform
Enterprise.
Private Registry
HCP Terraform's private registry works similarly to the public Terraform Registry and helps you share Terraform
providers and Terraform modules across your organization. It includes support for versioning and a searchable
list of available providers and modules.
HCP Terraform allows users to create and confidentially share infrastructure modules within an organization
using the private registry. With Terraform Enterprise, the private registry allows you to share modules within
or across organizations.
Modules from the private registry can be referenced using a registry source address of the form
app.terraform.io/<ORGANIZATION-NAME>/terraform/<NAME>/<PROVIDER>
.
Back to Top
Teams
Teams are groups of HCP Terraform users within an organization. If a user belongs to at least one team in
an organization, they are considered a member of that organization.
Team management is available in HCP Terraform Essentials, Standard, and Premium editions.
Collaboration features:
- Manage access to workspaces, projects, and organization.
- Share access to workspaces and state.
- Configure notification via Slack / Microsoft Teams / Email.
Policy Enforcement
Policies are rules that HCP Terraform enforces on Terraform runs. You can use two policy-as-code frameworks
to define fine-grained, logic-based policies: Sentinel and Open Policy Agent (OPA).
- Sentinel: You define policies with the Sentinel policy language and use imports to parse the Terraform
plan, state, and configuration.
- OPA: You define policies with the Rego policy language.
A policy consists of:
- The policy controls defined as code.
- An enforcement level that determines run behavior in the event of policy failure.
Policy sets are a named grouping of policies and their enforcement levels.
Each policy set can apply to specific workspaces, or to all workspaces within an organization.
Policy sets are the mapping between policies and workspaces.
Enforcement levels establish whether or not an operation can proceed if a policy fails.
Sentinel provides three enforcement levels:
- Hard-mandatory requires that the policy passes. If a policy fails, the run stops.
You must resolve the failure to proceed.
- Soft-mandatory lets an organization owner or a user with override privileges proceed with the run
in the event of failure. HCP Terraform logs all overrides.
- Advisory will notify you of policy failures, but proceed with the operation.
Terraform Version
Each HCP Terraform workspace has an assigned Terraform version that it uses for all remote operations in
the workspace.
When you create a new workspace, HCP Terraform automatically selects the most recent version of Terraform
available. HCP Terraform lets you change the version a workspace uses on the workspace's settings page
to control how and when your projects use newer versions of Terraform.
Back to Top
How can you trigger a HCP Terraform run in a workspace that is connected to a Version Control System (VCS) repository?
Answer: HCP Terraform workspaces connected to a VCS repository automatically trigger runs when changes are committed
to the connected branch of the repository.
How do HCP Terraform and Terraform Enterprise workspaces conceptually differ from Terraform CLI directories?
Answer: HCP Terraform manages infrastructure collections using workspaces that function conceptually like
separate working directories, contrasting with the directory-based approach often used in Terraform CLI.
How do you exclude certain files from being uploaded to the HCP Terraform workspace?
Answer: Files listed in the .terraformignore
file at the root of your configuration directory are
excluded from being uploaded to HCP Terraform.
Which features are available only in Terraform Enterprise or HCP Terraform workspaces and not in Terraform CLI?
Answer: The features available only in Terraform Enterprise or Terraform Cloud workspaces, and not in Terraform CLI, include:
- Secure variable storage.
- Remote execution & state management - Runs Terraform plans and applies in a managed environment with automatic
state storage and locking.
- Policy as Code - Enforces organizational policies before apply operations.
- Run history and detailed logging - Tracks all runs, outputs, and user actions in a central UI.
- Notifications & integrations - Connects to systems like Slack or email for workspace updates.
- Team and user access controls (RBAC) - Fine-grained permissions for managing workspaces and operations.
Terraform CLI provides the core infrastructure automation engine, but HCP Terraform and Terraform Enterprise
add collaboration, governance, and security features designed for teams and organizations. These hosted or
self-managed platforms extend Terraform's capabilities beyond local execution.
What is HCP Terraform and how does it differ from the Terraform CLI?
Answer: HCP Terraform (formerly Terraform Cloud) is a managed service provided by HashiCorp that offers remote
execution, state management, team collaboration, and governance features.
Unlike the local CLI, HCP Terraform centralizes state files, supports role-based access control, and integrates
with version control systems for automated runs and secure variable management.
What are HCP Terraform workspaces and what purpose do they serve?
Answer: Workspaces in HCP Terraform are isolated environments that store state, variables, and run history
for a specific set of configurations.
They allow teams to manage multiple infrastructure environments (like dev, test, and prod) independently while
keeping states separate and secure.
What are Variable Sets in HCP Terraform and how are they used?
Answer: Variable Sets in HCP Terraform are collections of variables that can be shared across multiple workspaces or projects.
They help enforce consistency and reduce duplication, for example, a Variable Set can store common credentials or
region settings used by all production workspaces.
How does HCP Terraform handle secure variable storage?
Answer: HCP Terraform securely stores variables by encrypting them at rest and in transit.
Sensitive variables can be marked as "sensitive," ensuring they are not displayed in logs or the user interface.
This provides a secure mechanism for managing secrets without embedding them in configuration files or code repositories.
What collaboration and governance features does HCP Terraform provide?
Answer: HCP Terraform provides team collaboration through role-based access control (RBAC), policy enforcement
using Sentinel or OPA, detailed run history, and VCS integration for workflow automation.
These features enable teams to review, approve, and control infrastructure changes securely and consistently
across an organization.
Back to Top