Problem
When you use config-driven imports in an HCP Terraform workspace, the run fails with the following error:
╷│ Error: Compatibility error││ Error reading TFC agent version. To proceed, please remove any import│ blocks from your config. Please report the following error to the Terraform│ team: TFC_AGENT_VERSION not present.╵
Prerequisites
- Terraform CLI version
1.5.0or newer. - An HCP Terraform workspace configured for agent execution mode.
Cause
Terraform CLI version 1.5.0 and newer attempts to detect the version of the HCP Terraform agent executing the run to determine its supported features. Support for Terraform v1.5 was added in v1.10.0 of the HCP Terraform agent.
While the HCP Terraform agent is designed to automatically update itself, some workflows involve disabling auto-updates and pinning the agent to a specific, older version. This error occurs when the agent version is older than v1.10.0.
Solution
To resolve this issue, update the HCP Terraform agent to version v1.10.0 or greater. You can do this by pulling the latest container image or by downloading the latest agent release.