hashicorp/terraform · error
Import blocks are not supported in this version of Terraform
Error message
Import blocks are not supported in this version of Terraform Enterprise. Please remove any import blocks from your config or upgrade Terraform Enterprise.
What it means
Raised by AssertImportCompatible when configuration-driven import is used in a remote TFC run but the remote API version is older than 2.6 (the minimum that supports import blocks). It tells the user the backend cannot honour import blocks until upgraded.
Source
Thrown at internal/cloud/backend_plan.go:348
}
return r, nil
}
// AssertImportCompatible errors if the user is attempting to use configuration-
// driven import and the version of the agent or API is too low to support it.
func (b *Cloud) AssertImportCompatible(config *configs.Config) error {
// Check TFC_RUN_ID is populated, indicating we are running in a remote TFC
// execution environment.
if len(config.Module.Import) > 0 && os.Getenv("TFC_RUN_ID") != "" {
// First, check the remote API version is high enough.
currentAPIVersion, err := version.NewVersion(b.client.RemoteAPIVersion())
if err != nil {
return fmt.Errorf("Error parsing remote API version. To proceed, please remove any import blocks from your config. Please report the following error to the Terraform team: %s", err)
}
desiredAPIVersion, _ := version.NewVersion("2.6")
if currentAPIVersion.LessThan(desiredAPIVersion) {
return fmt.Errorf("Import blocks are not supported in this version of Terraform Enterprise. Please remove any import blocks from your config or upgrade Terraform Enterprise.")
}
// Second, check the agent version is high enough.
agentEnv, isSet := os.LookupEnv("TFC_AGENT_VERSION")
if !isSet {
return fmt.Errorf("Error reading HCP Terraform 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.")
}
currentAgentVersion, err := version.NewVersion(agentEnv)
if err != nil {
return fmt.Errorf("Error parsing HCP Terraform Agent version. To proceed, please remove any import blocks from your config. Please report the following error to the Terraform team: %s", err)
}
desiredAgentVersion, _ := version.NewVersion("1.10")
if currentAgentVersion.LessThan(desiredAgentVersion) {
return fmt.Errorf("Import blocks are not supported in this version of the HCP Terraform Agent. You are using agent version %s, but this feature requires version %s. Please remove any import blocks from your config or upgrade your agent.", currentAgentVersion, desiredAgentVersion)
}
}
return nil
}View on GitHub (pinned to c9def3e214)
Solutions
- Upgrade Terraform Enterprise to version 2.6 or later.
- Remove import {} blocks from the config and import resources imperatively via 'terraform import' instead.
- Run locally (do not set TFC_RUN_ID / use local execution mode) if you cannot upgrade the backend.
Example fix
// before (config using import blocks, run against TFE < 2.6)
import {
to = aws_instance.web
id = "i-abc"
}
// after: imperative import against old TFE
terraform import aws_instance.web i-abc Defensive patterns
Strategy: validation
Validate before calling
// Require API >= 2.6 before submitting configs with import blocks.
const minImportAPI = "2.6"
if hasImportBlocks(cfg) && semverLT(apiVersion, minImportAPI) {
return fmt.Errorf("API %s < %s; upgrade TFE or remove import blocks", apiVersion, minImportAPI)
} Type guard
func supportsImportBlocks(apiVer string) bool {
cur, e1 := version.NewVersion(apiVer)
min, _ := version.NewVersion("2.6")
return e1 == nil && !cur.LessThan(min)
} Prevention
- Upgrade TFE before adopting import blocks.
- Maintain an imperative-import workflow for legacy backends.
- Document the min TFE version in the config's README.
When it happens
Trigger: config has import blocks, TFC_RUN_ID is set, the API version parses but currentAPIVersion.LessThan(desiredAPIVersion) where desired is "2.6".
Common situations: Running an older Terraform Enterprise on-prem install (pre-2.6) while configuration uses import {} blocks; or a stale/under-provisioned HCP Terraform backend.
Related errors
- Error parsing remote API version. To proceed, please remove
- Import blocks are not supported in this version of the HCP T
- Error reading HCP Terraform Agent version. To proceed, pleas
- Error parsing HCP Terraform Agent version. To proceed, pleas
- your version of Terraform Enterprise does not support key-va
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/ca72ba754c0fe959.
Report an issue: GitHub.