Skip to content

helper/resource: include step number in import state verification failures - #671

Open
massimomazzariol wants to merge 1 commit into
hashicorp:mainfrom
massimomazzariol:fix-import-state-step-number
Open

helper/resource: include step number in import state verification failures#671
massimomazzariol wants to merge 1 commit into
hashicorp:mainfrom
massimomazzariol:fix-import-state-step-number

Conversation

@massimomazzariol

Copy link
Copy Markdown

Related Issue

Fixes #525

Description

When import state verification cannot find the imported resource ID in the prior state, the verification currently calls t.Fatalf directly. This prevents the outer test step runner from adding the step number to the failure message.

This change returns the verification error instead, allowing the existing import step error handling to report the failure with its step number.

A regression test was added to verify that the final error includes Step 2/2, along with a Changie entry for the bug fix.

Testing

The import state test package passes with both Go versions used by the repository CI matrix:

  • GOTOOLCHAIN=go1.25.12 go test ./helper/resource/importstate -count=1
  • GOTOOLCHAIN=go1.26.5 go test ./helper/resource/importstate -count=1

Tested with:

  • Windows 11 Pro 10.0.26200
  • Terraform 1.15.8
  • Go 1.25.12 and 1.26.5
  • Git 2.54.0.windows.1

go test ./... -count=1 also encounters pre-existing Windows-specific failures in config, helper/resource, and internal/teststep. The same failures were reproduced on an unmodified upstream/main worktree.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No changes to security controls.

@massimomazzariol
massimomazzariol requested a review from a team as a code owner July 24, 2026 11:03
@hashicorp-cla-app

hashicorp-cla-app Bot commented Jul 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some import test failures do not show step number

1 participant