Problem
When using the resource import block feature in Terraform Enterprise (TFE) version v202307-1 or v202308-1, a run may fail with the following compatibility 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.
This error can occur even if the hashicorp/tfe-agent:latest image is expected to be version 1.10.0 or higher, which supports the import block functionality as described in the import blocks documentation.
Cause
This issue typically occurs after upgrading an existing TFE instance. During an upgrade, the hashicorp/tfe-agent:latest Docker tag may not be updated to point to the newer agent image bundled with the release. As a result, TFE continues to use an older agent version that does not support import blocks.
A fresh installation of TFE v202307-1 or v202308-1 correctly tags the v1.10.0 agent as latest, so this problem is specific to upgraded environments.
You can verify the version of the agent image currently tagged as latest.
# docker inspect hashicorp/tfe-agent:latest
The output may show an older version, such as 1.7.1, instead of the expected 1.10.0 or higher.
## ...
"Labels": {
"com.hashicorp.version": "1.7.1",
"com.hashicorp.container-type": "tfe-agent",
## ...Solutions
Here are three potential solutions to resolve this issue.
Solution 1: Upgrade Terraform Enterprise
Upgrade your Terraform Enterprise instance to version v202309-1 or a more recent release. Newer versions contain fixes that address the agent image tagging behavior during upgrades.
Solution 2: Recreate the Agent Image
You can manually remove the outdated tfe-agent:latest image. When TFE restarts, it will detect the missing image and automatically recreate it, correctly pointing to the latest version included with your TFE installation.
- SSH to the Terraform Enterprise instance.
-
Stop the Terraform Enterprise application.
# replicatedctl app stop
-
Confirm the application is fully stopped before proceeding.
# replicatedctl app status
-
Delete the existing agent image.
# docker rmi -f hashicorp/tfe-agent:latest
-
Start the Terraform Enterprise application.
# replicatedctl app start
-
Confirm that the image has been recreated.
# docker images | grep hashicorp/tfe-agent
The output should show a newly created image.
hashicorp/tfe-agent latest f78028f6be16 Less than a minute ago 387MB
Solution 3: Rebuild a Custom Agent Image
If you use a custom agent image, you must ensure it is built from a base agent image that is version 1.10.0 or higher.
-
Update the
FROMinstruction in yourDockerfileto use a compatible base image.FROM hashicorp/tfe-agent:latest
-
Verify the version of your local base image.
# docker image inspect hashicorp/tfe-agent:latest -f '{{.Config.Labels}}' -
If the version is older than
1.10.0, pull a newer version and retag it aslatest.# docker rmi hashicorp/tfe-agent:latest # docker pull hashicorp/tfe-agent:1.10 # docker tag hashicorp/tfe-agent:1.10 hashicorp/tfe-agent:latest
- Rebuild your custom agent image using the updated base image.
Outcome
After applying one of these solutions, your Terraform Enterprise instance will use a tfe-agent of version 1.10.0 or higher, enabling successful runs with import blocks.