hashicorp/terraform · error

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

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

Raised by AssertImportCompatible when the HCP Terraform Agent version parses but is older than 1.10, the minimum that supports configuration-driven import blocks. The message names the running version and the required version.

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 c9def3e214)

Solutions

  1. Upgrade the HCP Terraform Agent image to version 1.10 or newer (update the agent pool / agent version in HCP).
  2. Remove import blocks from the config and import resources imperatively.
  3. Switch the workspace to local execution or an agent pool with a supported version.

Example fix

// before: workspace pinned to agent v1.8 with import blocks
import { to = aws_instance.web  id = "i-1" }
// after: upgrade agent pool to >= 1.10 (UI: Settings -> Agent -> version), then re-run
Defensive patterns

Strategy: validation

Validate before calling

const minAgent = "1.10"
if cur, err := version.NewVersion(os.Getenv("TFC_AGENT_VERSION")); err == nil {
    min, _ := version.NewVersion(minAgent)
    if cur.LessThan(min) {
        return fmt.Errorf("agent %s < %s; upgrade before using import blocks", cur, minAgent)
    }
}

Type guard

func agentSupportsImport(agentVer string) bool {
    cur, e1 := version.NewVersion(agentVer)
    min, _ := version.NewVersion("1.10")
    return e1 == nil && !cur.LessThan(min)
}

Prevention

When it happens

Trigger: import blocks present, TFC_RUN_ID set, API version OK, TFC_AGENT_VERSION parses but currentAgentVersion.LessThan(desired "1.10").

Common situations: Workspace bound to an agent pool running an older agent image (pre-1.10); import blocks added to a config that previously worked; agent pool not updated after a Terraform core upgrade.

Related errors


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