Workspace templates
Create workspace templates to standardize configurations, and learn how template-locked fields behave when you update a linked workspace.
With workspace templates, you standardize workspace configurations across your projects by predefining variables, settings, and other workspace options. Templates streamline setup, keep workspaces consistent, and let platform teams lock specific settings so they cannot drift after a workspace is linked.
What you will learn from this topic
How to create, edit, and apply a workspace template.
The difference between linking a workspace to a template and copying a template.
Which workspace settings a template can lock.
How Harness behaves when you update a locked field on a linked workspace.
How to change the template version a workspace uses.
Before you begin
Template permissions: Permission to create and edit account-level or project-level templates. Go to RBAC in Harness to configure roles.
Target scope: Access to an account or project where you apply the template.
Workspace basics: Familiarity with workspace setup. Go to the IaCM get started guide to review the workspace creation flow.
Use a template or copy a template
When you apply a workspace template, you choose how the new workspace relates to the template.
Use Template: The workspace stays linked to the template and reflects future template changes. Settings the template locks are enforced on the workspace.
Copy Template: Harness creates a one-time copy of the template as it exists at that moment. The workspace is independent, no settings are locked, and later template changes do not apply.
Configure workspace templates
To configure workspace templates and standardize your workspace setups, follow this interactive guide.
Use these steps to create a template, edit an existing template, and apply a template to a new workspace.
Create a new workspace template
In Account Settings, select Templates from the Account-level resources section.
Select the New Template dropdown, then select Infra Workspace.
Name the template and provide a version label.
Select Start.
Harness opens the template General tab, which contains a standard workspace setup form. Go to the IaCM get started guide to review each field.
Complete the workspace setup.
Select the Variables tab and add workspace variables (optional).
Select Save.
Select YAML from the Visual/YAML toggle to preview or edit the generated configuration.
Review and edit an existing workspace template
Select Templates to open the workspace template overview page, either from the breadcrumb menu or from Account Settings, then Templates.
Select the workspace template to review.
To edit, select Open in Template Studio.
Update the workspace settings, then select Save.
Apply a workspace template
In one of your projects, create a new workspace.
When prompted, select Start with Template.
Name the new workspace, then select Start.
Search for the template you want, then select it.
Select Use Template or Copy Template.
Review the applied configuration and variables.
Locked fields
When you build a template, you can lock individual settings. A locked setting is enforced on every workspace that links to the template through Use Template. Locking keeps critical configuration consistent and prevents workspace owners from changing values your platform team controls.
Locked settings apply only to linked workspaces. A workspace created with Copy Template has no locked settings, because it is an independent copy with no ongoing association.
You can lock the following template settings.
Provisioner: Provisioner type, provisioner version, and the provider connector.
Repository: Repository name, connector, path, and the Git fetch type with its branch, commit, or tag value.
Cost estimation: Whether cost estimation is enabled, and the budget.
Terraform and environment variables: The value of any locked variable. Template-provided variables also cannot be removed from a linked workspace.
Terraform variable files: Locked variable files cannot be removed.
Provider connectors: Locked provider connectors cannot be removed.
Default pipelines: The plan, apply, destroy, and drift pipelines, for project-level templates.
Required tags: Tags the template requires must remain on the workspace.
Settings that the template does not lock remain editable on each linked workspace.
Update a linked workspace
Harness validates every update to a linked workspace against the template version the workspace currently uses. When an update keeps the locked values, the update succeeds. When an update changes a locked value, removes a locked variable file or provider connector, removes a template-provided variable, or drops a required tag, Harness rejects the entire update and returns a validation error that lists the conflicting fields. Harness does not silently strip or ignore the change, so the workspace always matches the template.
To change a locked value, update the value in the template, or move the workspace to a template version that allows the change. To change a value the template does not lock, edit the workspace as usual.
Change the template version
A linked workspace points to a specific template version. When you move the workspace to a different version, Harness reconciles the workspace against the new version and overwrites any locked settings with the values from that version. Fields the new version does not lock are left as they are.
Review the changes before you apply them so you know which locked settings will change. Go to Workspace statuses to confirm the workspace returns to an active state after reconciliation.
Troubleshooting
Next steps
Workspace templates standardize setup, enforce locked settings, and reduce the risk of misconfiguration across projects.
Go to Connectors and variables to manage connectors and variables on a workspace.
Go to Cost estimation to configure cost estimation and budgets.
Go to Workspace tabs to review the settings available on a workspace.
Last updated
Was this helpful?