hashicorp/terraform · error

Import blocks are not supported in this version of the HCP…

Error message

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.

What it means

Thrown by Cloud.AssertImportCompatible when the parsed HCP Terraform Agent version is less than 1.10. Even if the API supports import (>= 2.6), the agent itself must be >= 1.10 to handle configuration-driven import blocks. This is the agent-side version floor, checked after the API and env-var checks pass.

Solutions

  1. Upgrade the HCP Terraform Agent to version 1.10 or later.
  2. Remove import blocks from the configuration and use `terraform import` CLI instead.
  3. If running multiple agent pools, ensure the workspace is assigned to an upgraded pool.

Example fix

// before - agent 1.9 with import blocks fails
import {
  to = aws_instance.example
  id = "i-1234567890abcdef0"
}
// after - upgrade agent image to >= 1.10, or remove the import block
Defensive patterns

Strategy: validation

Validate before calling

// Confirm agent version >= 1.10 before allowing import blocks.
floor, _ := version.NewVersion("1.10")
if v, err := version.NewVersion(os.Getenv("TFC_AGENT_VERSION")); err == nil && v.LessThan(floor) {
    // reject import blocks
}

Type guard

func agentSupportsImport(agentVersion string) bool {
    v, err := version.NewVersion(agentVersion)
    if err != nil { return false }
    floor, _ := version.NewVersion("1.10")
    return !v.LessThan(floor)
}

Prevention

When it happens

Trigger: Import blocks present, TFC_RUN_ID set, API >= 2.6, TFC_AGENT_VERSION present and parseable, but the parsed agent version is < 1.10. The agent runtime is too old to execute import blocks.

Common situations: HCP Terraform Agent deployment pinned to a pre-1.10 image; an organization that hasn't upgraded its agent pools; a dev/test agent image built from an older release tag.

Related errors


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

Appendix: source

Thrown at internal/cloud/backend_plan.go:362

			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
}

// renderPlanLogs reads the streamed plan JSON logs and calls the JSON Plan renderer (jsonformat.RenderPlan) to
// render the plan output. The plan output is fetched from the redacted output endpoint.
func (b *Cloud) renderPlanLogs(ctx context.Context, op *backendrun.Operation, run *tfe.Run) error {
	logs, err := b.client.Plans.Logs(ctx, run.Plan.ID)
	if err != nil {
		return err
	}

	if b.CLI != nil {
		reader := bufio.NewReaderSize(logs, 64*1024)

		for next := true; next; {
			var l, line []byte

View on GitHub (pinned to d32a084675)