hashicorp/terraform · error

Import blocks are not supported in this version of…

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

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.

Solutions

  1. Upgrade Terraform Enterprise / ensure HCP Terraform is on API version 2.6 or later.
  2. Remove all import blocks from the configuration and use the older `terraform import` CLI workflow instead.
  3. Confirm the API version with your TFE admin and plan an upgrade before re-adding import blocks.

Example fix

// before - import block requires API >= 2.6
import {
  to = aws_instance.example
  id = "i-1234567890abcdef0"
}
// after - use CLI import against older TFE
// $ terraform import aws_instance.example i-1234567890abcdef0
Defensive patterns

Strategy: validation

Validate before calling

// Gate import-block usage on a known-good API version.
const minAPI = "2.6"
cur, _ := version.NewVersion(b.client.RemoteAPIVersion())
floor, _ := version.NewVersion(minAPI)
if len(config.Module.Import) > 0 && cur.LessThan(floor) {
    // strip import blocks or refuse to run
}

Type guard

func apiSupportsImport(apiVersion string) bool {
    cur, err := version.NewVersion(apiVersion)
    if err != nil { return false }
    floor, _ := version.NewVersion("2.6")
    return !cur.LessThan(floor)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/ca72ba754c0fe959. Report an issue: GitHub.

Appendix: 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 d32a084675)