-
Notifications
You must be signed in to change notification settings - Fork 16
importstate: a working example of ImportState as the first TestStep #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b8a65c8
to
70f740d
Compare
helper/resource/importstate/import_command_as_first_step_test.go
Outdated
Show resolved
Hide resolved
One detail that I remembered: the only reason As mentioned above, I've removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM, I do have a question about the naming of one of the fields
if err := runPlanChecks(ctx, t, plan, step.ImportPlanChecks.PreApply); err != nil { | ||
return err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly related to this PR, but I noticed that we don't immediately return after running this import/plan and we probably should? Or wrap the remaining of the logic in this function in the following else block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Noted for a follow-up PR -- it will be easier to see the current picture after we merge this & the two PRs "stacked" atop it.
// TODO compare plan to state from previous step | ||
|
||
if err := runPlanChecks(ctx, t, plan, step.ImportPlanChecks.PreApply); err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should we wrap the error messages produced by the plan checks for readability?
return fmt.Errorf("Import plan check(s) failed:\n%w", err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Noted for a follow-up PR -- it will be easier to see the current picture after we merge this & the two PRs "stacked" atop it.
This PR adds a test to resolve the question: what happens if the first
TestStep
uses import mode?This test passes 🍏
Notably:
ImportStateVerify
does not work, because there is no previous step state to verify against.