Skip to content

docs: add a v1 to v2 migration guide - #1884

Open
james00012 wants to merge 6 commits into
mainfrom
docs/v2-migration-guide
Open

docs: add a v1 to v2 migration guide#1884
james00012 wants to merge 6 commits into
mainfrom
docs/v2-migration-guide

Conversation

@james00012

@james00012 james00012 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Closes OSS-4186.

A single place to read v1 to v2 migration instructions, at /docs/migrating-to-v2/overview/, mirroring the v1 guide.

Until now the only guidance was the beta.1 release notes plus docs/v2-import-map.md, which is a design artifact (it has an accounting section and a decision log) rather than something to hand a user.

Pages

overview What changed, the order to do it in, removed packages
rewriting-imports Bulk sed for the three transformations, symbol relocations, go.mod
import-map Full v1 to v2 path table
behaviour-changes The two k8s changes the compiler will not catch

The split follows the work: steps 1 to 3 are compile errors, so "if it builds, you are done". Step 4 is the only part that needs reading, so it gets its own page rather than being buried.

Two things the guide calls out that a path table alone would not:

  • Files that alias Terratest's aws because plain aws is the SDK. The symbol relocations produce a compile error there, so it needs a human.
  • Ordering: the core collapse has to run before the /v2 suffix rule, or it rewrites paths that do not exist.

Also links forward from the v1 overview, and renumbers 04_community to 05_community so ordering stays contiguous. Permalinks come from front matter category, so no URLs change.

Note

The import map says "the codemod handles both" for the package renames, but no codemod exists in the repo. I wrote out the sed commands instead. Worth either shipping a codemod or dropping that sentence.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive v1-to-v2 migration guidance, including behavior changes, import updates, package changes, and rewriting instructions.
    • Added guidance on version pinning for v1 and v2.
    • Added navigation links between migration resources.
    • Reorganized community documentation navigation and updated documentation category guidance.
    • Corrected a spelling error in the v2 behavior changes documentation.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19faf731-fc7c-47ca-8b65-91255ae0beb7

📥 Commits

Reviewing files that changed from the base of the PR and between 8148993 and 431bbc5.

📒 Files selected for processing (1)
  • docs/_docs/04_migrating-to-v2/overview.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/_docs/04_migrating-to-v2/overview.md

Walkthrough

Added Terratest v1-to-v2 migration documentation. The changes cover behavior changes, import mappings, rewrite steps, module version guidance, documentation navigation, and wording updates.

Changes

V2 migration documentation

Layer / File(s) Summary
Migration overview and behavior guidance
docs/_docs/03_migrating-to-v1/overview.md, docs/_docs/04_migrating-to-v2/..., docs/_docs/01_getting-started/version-pinning.md, README.md
Adds the v2 migration overview, documents k8s behavior and RestConfig serialization changes, explains module version requirements, and links to migration guidance.
Import mapping and rewrite procedure
docs/_docs/04_migrating-to-v2/import-map.md, docs/_docs/04_migrating-to-v2/rewriting-imports.md
Documents package mappings, ordered import rewrites, symbol relocations, alias handling, removed packages, and verification commands.
Documentation navigation and wording
docs/README.md, docs/_docs/05_community/*, docs/v2-import-map.md
Updates documentation categories and ordering, reformats contributing guidance, changes community page ordering, and corrects “Behaviour” to “Behavior”.

Estimated code review effort: 2 (Simple) | ~15 minutes

Mergeability Score: ⚪ Minimal · up to 431bb

This PR adds migration documentation and reorganizes documentation numbering without changing product behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested reviewers: denis256, yhakbar

Poem

V1 paths meet a v2 sign,
Imports shift in a tidy line.
Nodes find addresses clear,
Config limits now appear.
Docs align, and headings shine.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding documentation for migrating from v1 to v2.
Description check ✅ Passed The description explains the guide’s purpose, pages, migration steps, compatibility details, and documentation changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/v2-migration-guide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@james00012
james00012 marked this pull request as ready for review August 12, 2026 03:59
Brian is dogfooding the v2 beta and the only guidance available was the
beta.1 release notes plus docs/v2-import-map.md, which is a design artifact
with an accounting section and a decision log rather than user docs.

Adds docs/_docs/04_migrating-to-v2/, mirroring the migrating-to-v1
collection so it lands at /docs/migrating-to-v2/overview/:

- overview: what changed, the order to do it in, removed packages
- rewriting-imports: bulk sed for the three transformations, the two places
  a blind replace gets it wrong, symbol relocations, go.mod
- import-map: the full v1 to v2 path table
- behaviour-changes: the two k8s changes the compiler will not catch

Also links forward from the v1 overview, and renumbers the community
collection to 05 so ordering stays contiguous. Permalinks come from front
matter, so no URLs change.
Use 'behavior' not 'behaviour', which is what the rest of docs/ uses, and
rename the page accordingly. Wrap prose at 75 columns and close with a PR
pointer, both matching the migrating-to-v1 collection.
@james00012
james00012 force-pushed the docs/v2-migration-guide branch from bcc2d20 to 0da1ab4 Compare August 12, 2026 04:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/_docs/04_migrating-to-v2/overview.md`:
- Around line 44-46: Remove formatting from the public utility package list in
docs/_docs/04_migrating-to-v2/overview.md:44-46, and remove formatting from the
rewrite expression in docs/_docs/04_migrating-to-v2/rewriting-imports.md:22-29.
Keep the remaining public utility mappings unchanged.

In `@docs/_docs/04_migrating-to-v2/rewriting-imports.md`:
- Line 109: Update the unlabeled code fence in the migrating-to-v2 imports
documentation to use the go language tag on its opening fence, leaving the
fenced content unchanged.
- Around line 52-56: Update the migration instructions after “Then let the
compiler find the rest” to use the project’s test compilation command instead of
only “go mod tidy && go build ./...”, ensuring _test.go files and their imports
are compiled during migration.
- Around line 26-29: Update the sed commands in the import-rewriting
documentation to use POSIX ERE syntax: replace escaped alternation with plain |
under -E, and replace non-portable \b boundaries with explicit portable boundary
patterns. Ensure all three commands reliably rewrite the intended imports and
package identifiers on BSD/macOS sed.

In `@docs/v2-import-map.md`:
- Line 85: Update the “Behavior changes during the v2 beta” heading so the
legacy fragment `#behaviour-changes-during-the-v2-beta` remains valid, either by
restoring the original spelling or adding an explicit alias while preserving the
current heading.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d771a18f-75e8-4c60-a24a-e85438af232b

📥 Commits

Reviewing files that changed from the base of the PR and between b28c2fd and bcc2d20.

📒 Files selected for processing (9)
  • docs/_docs/03_migrating-to-v1/overview.md
  • docs/_docs/04_migrating-to-v2/behavior-changes.md
  • docs/_docs/04_migrating-to-v2/import-map.md
  • docs/_docs/04_migrating-to-v2/overview.md
  • docs/_docs/04_migrating-to-v2/rewriting-imports.md
  • docs/_docs/05_community/contributing.md
  • docs/_docs/05_community/license.md
  • docs/_docs/05_community/support.md
  • docs/v2-import-map.md

Comment thread docs/_docs/04_migrating-to-v2/overview.md Outdated
Comment thread docs/_docs/04_migrating-to-v2/rewriting-imports.md
Comment thread docs/_docs/04_migrating-to-v2/rewriting-imports.md Outdated
Comment thread docs/_docs/04_migrating-to-v2/rewriting-imports.md Outdated
Comment thread docs/v2-import-map.md
The sed commands did not work on the platform they were written for. BSD
sed has no \b, so the three identifier rewrites silently did nothing on
macOS, leaving every call site undefined. Use an explicit boundary class
and # as the delimiter, and drop the false claim that the blocks are
order-dependent. Add the alias-stripping expression, without which
test_structure "..." keeps the old alias bound to the renamed package, and
add gofmt.

Add the largest missing step: v2 deletes everything v1 deprecated, not just
the non-Context wrappers. Point at staticcheck SA1019 as the way to find it.

Correct: formatting was never a v1 package and is now public at
core/v2/formatting; GetServiceEndpoint has no non-Context form; 22 AWS
service clients, not 23; ErrRestConfigNotSerializable is wrapped so it
needs errors.Is; NodePublicIPLookup is only consulted for aws provider IDs.

Verify with go test -run '^$' rather than go build, since go build does not
compile _test.go and that is where a Terratest suite lives.

Retitle to 'v2 overview' so it stops colliding with the v1 page on the docs
index, add the missing version and go get guidance, note the v2 exception
on the v1 version-pinning page, and refresh the stale category list in
docs/README.md.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/_docs/04_migrating-to-v2/overview.md`:
- Around line 23-27: Update the “Should you migrate yet” section to state that
v1 receives security fixes only, matching the support policy wording in
README.md, while preserving the surrounding migration guidance.
- Around line 128-129: Update the introductory sentence near “Six packages and
two binaries are not carried forward” to replace “Most” with an accurate
statement that only three packages have standard-library replacements, such as
“Three have a standard-library replacement.”
- Around line 123-124: Update the migration overview’s “Steps 1 to 4” guidance
so a successful build only resolves the compile-error steps, not the entire
migration. Explicitly require completing the manual Kubernetes behavior review
in Step 5 before marking the migration complete.

In `@docs/_docs/04_migrating-to-v2/rewriting-imports.md`:
- Around line 35-43: Update the final cleanup expression in the import-rewriting
command to match any whitespace indentation, including spaces, instead of only
tabs. Preserve the existing alias removal for http_helper, dns_helper, and
test_structure so space-indented imports are rewritten to the correct package
names.

In `@docs/README.md`:
- Line 189: Correct the wording in the order description by changing “it is use”
to “it is used,” preserving the existing ordering guidance and examples.
- Line 92: Update the documentation metadata example and description in
docs/README.md to use the singular category field instead of categories, while
preserving the listed category values and navigation guidance.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4dcd9e5-746a-4baa-b8f1-77aeb60abf73

📥 Commits

Reviewing files that changed from the base of the PR and between bcc2d20 and 9d59d6b.

📒 Files selected for processing (7)
  • README.md
  • docs/README.md
  • docs/_docs/01_getting-started/version-pinning.md
  • docs/_docs/04_migrating-to-v2/behavior-changes.md
  • docs/_docs/04_migrating-to-v2/import-map.md
  • docs/_docs/04_migrating-to-v2/overview.md
  • docs/_docs/04_migrating-to-v2/rewriting-imports.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/_docs/04_migrating-to-v2/import-map.md
  • docs/_docs/04_migrating-to-v2/behavior-changes.md

Comment thread docs/_docs/04_migrating-to-v2/overview.md
Comment thread docs/_docs/04_migrating-to-v2/overview.md Outdated
Comment thread docs/_docs/04_migrating-to-v2/overview.md Outdated
Comment thread docs/_docs/04_migrating-to-v2/rewriting-imports.md
Comment thread docs/README.md Outdated
Comment thread docs/README.md Outdated
Match README's v1 policy wording (security fixes only, not 'gets fixes').
Stop implying a green build means the migration is done, since the k8s
behavior changes compile either way. Three of the six removed packages have
a standard library replacement, not most.

Strip aliases from space-indented import blocks too, not just tab-indented
ones: a file that has not been gofmt'd yet would otherwise keep the old
alias and fail to compile after the call-site rewrite.

docs/README.md documented a plural categories field that no page uses, and
had a typo in the order sentence.
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.

1 participant