{"record":{"id":"ca72ba754c0fe959","repo":"hashicorp/terraform","slug":"import-blocks-are-not-supported-in-this-version-of","errorCode":null,"errorMessage":"Import blocks are not supported in this version of Terraform Enterprise. Please remove any import blocks from your config or upgrade Terraform Enterprise.","messagePattern":"Import blocks are not supported in this version of Terraform Enterprise\\. Please remove any import blocks from your config or upgrade Terraform Enterprise\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_plan.go","lineNumber":348,"sourceCode":"\t}\n\n\treturn r, nil\n}\n\n// AssertImportCompatible errors if the user is attempting to use configuration-\n// driven import and the version of the agent or API is too low to support it.\nfunc (b *Cloud) AssertImportCompatible(config *configs.Config) error {\n\t// Check TFC_RUN_ID is populated, indicating we are running in a remote TFC\n\t// execution environment.\n\tif len(config.Module.Import) > 0 && os.Getenv(\"TFC_RUN_ID\") != \"\" {\n\t\t// First, check the remote API version is high enough.\n\t\tcurrentAPIVersion, err := version.NewVersion(b.client.RemoteAPIVersion())\n\t\tif err != nil {\n\t\t\treturn 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)\n\t\t}\n\t\tdesiredAPIVersion, _ := version.NewVersion(\"2.6\")\n\t\tif currentAPIVersion.LessThan(desiredAPIVersion) {\n\t\t\treturn 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.\")\n\t\t}\n\n\t\t// Second, check the agent version is high enough.\n\t\tagentEnv, isSet := os.LookupEnv(\"TFC_AGENT_VERSION\")\n\t\tif !isSet {\n\t\t\treturn 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.\")\n\t\t}\n\t\tcurrentAgentVersion, err := version.NewVersion(agentEnv)\n\t\tif err != nil {\n\t\t\treturn 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)\n\t\t}\n\t\tdesiredAgentVersion, _ := version.NewVersion(\"1.10\")\n\t\tif currentAgentVersion.LessThan(desiredAgentVersion) {\n\t\t\treturn 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)\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_plan.go#L330-L366","documentation":"Thrown by Cloud.AssertImportCompatible when the parsed remote API version is less than 2.6. Configuration-driven import blocks require TFE/HCP API version 2.6 or higher; older API versions lack the server-side support for import blocks. The check runs only in remote execution (TFC_RUN_ID set) with import blocks present.","triggerScenarios":"config.Module.Import is non-empty, TFC_RUN_ID is set, RemoteAPIVersion parsed successfully but is < 2.6. This is a hard version floor: the TFE instance is too old to support import blocks.","commonSituations":"Self-hosted Terraform Enterprise on a pre-2.6 release; HCP Terraform pinned to an older tier; attempting import blocks against an outdated TFE installation.","solutions":["Upgrade Terraform Enterprise / ensure HCP Terraform is on API version 2.6 or later.","Remove all import blocks from the configuration and use the older `terraform import` CLI workflow instead.","Confirm the API version with your TFE admin and plan an upgrade before re-adding import blocks."],"exampleFix":"// before - import block requires API >= 2.6\nimport {\n  to = aws_instance.example\n  id = \"i-1234567890abcdef0\"\n}\n// after - use CLI import against older TFE\n// $ terraform import aws_instance.example i-1234567890abcdef0","handlingStrategy":"validation","validationCode":"// Gate import-block usage on a known-good API version.\nconst minAPI = \"2.6\"\ncur, _ := version.NewVersion(b.client.RemoteAPIVersion())\nfloor, _ := version.NewVersion(minAPI)\nif len(config.Module.Import) > 0 && cur.LessThan(floor) {\n    // strip import blocks or refuse to run\n}","typeGuard":"func apiSupportsImport(apiVersion string) bool {\n    cur, err := version.NewVersion(apiVersion)\n    if err != nil { return false }\n    floor, _ := version.NewVersion(\"2.6\")\n    return !cur.LessThan(floor)\n}","tryCatchPattern":null,"preventionTips":["Keep TFE on API >= 2.6 if using configuration-driven import.","Prefer `terraform import` CLI on older TFE.","Document the API-version floor in CI run docs for teams using import blocks."],"tags":["terraform","import","tfe","api-version","version-check","remote-execution"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}