Introduction
When managing workspace tags in HCP Terraform, you may observe inconsistent behavior between the UI and API responses. This article explains why workspace tags may appear in multiple UI sections or be missing from certain API endpoints, and outlines the recommended approach to ensure consistent tagging behaviour.
Problem
You may encounter one or more of the following issues when working with workspace tags in HCP Terraform:
Workspace tags appear in two different sections in the HCP Terraform UI.
Tags created by automation are missing from the
effective-tag-bindingsAPI response.Automation tools must read tags from multiple locations in the workspace JSON.
Tags added by automation are visible in the UI but are not editable.
This commonly occurs in environments where workspaces are created or managed using automation, SDKs, or legacy APIs.
Cause
HCP Terraform currently supports two tagging models, and mixing them leads to inconsistent UI and API behaviour:
1. Enhanced Tags
Key-value tags (e.g.,
env:Dev)Key-only tags (e.g.,
cloud)Stored under:
"relationships": {
. "tag-bindings": […]
}
-
Fully supported by:
HCP Terraform UI
effective-tag-bindingsAPI
2. Flat-String Tags
Single string tags (e.g.,
s)Created using the
attributes.tag-namesfield
"attributes": {
"tag-names": […]
}
Not returned by the
effective-tag-bindingsAPIDisplayed in a separate section in the UI and typically not editable
When both models are used on the same workspace, tags appear split across the UI and APIs.
Solutions:
-
Standardise on enhanced tags (key-value or key-only) using tag bindings
-
Update automation to create tags under: (If supported by the current SDK or APIs used)
relationships.tag-bindingsAvoid using
attributes.tag-namesfor new workspaces. -
List workspace tag bindings API currently returns only enhanced (key:value) tags. Flat-string tags are still applied successfully to the workspace, but they are not surfaced through this newer endpoint.
If you need to retrieve all flat-string tags associated with a workspace, you have to use the list workspace tags API instead in your automation.
-
Additional Information
-
Migration Guidance
-
Flat-string tags are not removed, but they are considered legacy. HashiCorp recommends migrating flat-string tags to enhanced key-value or key-only tags for:
Complete API visibility
Advanced use cases (Sentinel policies, governance, chargeback)
Refer to the official documentation for migration steps: https://developer.hashicorp.com/terraform/cloud-docs/workspaces/tags#migrate-single-value-tags
-
If you're still experiencing issues, please contact HCP Terraform Support by submitting a ticket through our support portal