|
| 1 | +# Terratest v2 Import Map |
| 2 | + |
| 3 | +Status: FROZEN. The one open decision (renames) is resolved: the three hyphenated packages are renamed to idiomatic Go names at the `/v2` boundary. |
| 4 | + |
| 5 | +Built from the actual v1 layout at tag `v1.0.1-test` (27 `modules/` packages, 2 `cmd/` binaries, 1 `internal/lib` tree). |
| 6 | + |
| 7 | +Module base path: `github.com/gruntwork-io/terratest` |
| 8 | + |
| 9 | +## Transformation rule |
| 10 | + |
| 11 | +For any surviving import path, the rewrite is a prefix replacement that also applies to every subpackage: |
| 12 | + |
| 13 | +- `modules/<name>/...` -> `modules/<name>/v2/...` (the `/v2` SIV goes after the module root; directory layout unchanged except for the three renames below) |
| 14 | +- The six tier-0 utilities collapse under one module: `modules/<util>/...` -> `modules/core/v2/<util>/...` |
| 15 | +- Three packages are also renamed to drop the hyphen: `http-helper` -> `httphelper`, `dns-helper` -> `dnshelper`, `test-structure` -> `teststructure`. The package identifier loses its underscore too (`http_helper` -> `httphelper`), so call sites change, not just the import path. The codemod handles both. |
| 16 | + |
| 17 | +So e.g. `modules/logger/parser` -> `modules/core/v2/logger/parser`, `modules/aws/foo` -> `modules/aws/v2/foo`, and `modules/http-helper` -> `modules/httphelper/v2`. |
| 18 | + |
| 19 | +## core collapse (6 v1 packages -> one `modules/core/v2`) |
| 20 | + |
| 21 | +| v1 import path | v2 import path | |
| 22 | +|---|---| |
| 23 | +| `modules/logger` | `modules/core/v2/logger` | |
| 24 | +| `modules/testing` | `modules/core/v2/testing` | |
| 25 | +| `modules/retry` | `modules/core/v2/retry` | |
| 26 | +| `modules/random` | `modules/core/v2/random` | |
| 27 | +| `modules/files` | `modules/core/v2/files` | |
| 28 | +| `modules/shell` | `modules/core/v2/shell` | |
| 29 | + |
| 30 | +## Standalone `/v2` submodules |
| 31 | + |
| 32 | +| v1 import path | v2 import path | |
| 33 | +|---|---| |
| 34 | +| `modules/aws` | `modules/aws/v2` | |
| 35 | +| `modules/azure` | `modules/azure/v2` | |
| 36 | +| `modules/gcp` | `modules/gcp/v2` | |
| 37 | +| `modules/k8s` | `modules/k8s/v2` | |
| 38 | +| `modules/helm` | `modules/helm/v2` | |
| 39 | +| `modules/ssh` | `modules/ssh/v2` | |
| 40 | +| `modules/docker` | `modules/docker/v2` | |
| 41 | +| `modules/packer` | `modules/packer/v2` | |
| 42 | +| `modules/database` | `modules/database/v2` | |
| 43 | +| `modules/opa` | `modules/opa/v2` | |
| 44 | +| `modules/terraform` | `modules/terraform/v2` | |
| 45 | +| `modules/terragrunt` | `modules/terragrunt/v2` | |
| 46 | +| `modules/http-helper` | `modules/httphelper/v2` | |
| 47 | +| `modules/dns-helper` | `modules/dnshelper/v2` | |
| 48 | +| `modules/test-structure` | `modules/teststructure/v2` | |
| 49 | + |
| 50 | +## Removed in v2.0.0 (deprecated in v1 first, deleted at cutover) |
| 51 | + |
| 52 | +| v1 import path | replacement | |
| 53 | +|---|---| |
| 54 | +| `modules/collections` | stdlib `slices` | |
| 55 | +| `modules/environment` | stdlib `os.Getenv` | |
| 56 | +| `modules/git` | stdlib `os/exec` | |
| 57 | +| `modules/slack` | none, vendor from frozen v1 if needed | |
| 58 | +| `modules/version-checker` | none, shell out | |
| 59 | +| `modules/oci` | none, Oracle Cloud support not carried forward; remains in frozen v1, vendor if needed | |
| 60 | +| `cmd/pick-instance-type` | none, standalone binary, out of scope | |
| 61 | +| `cmd/terratest_log_parser` | none, standalone binary (its `logger/parser` lib survives under `modules/core/v2/logger/parser`) | |
| 62 | + |
| 63 | +## Internal flatten (non-importable, not consumer-facing) |
| 64 | + |
| 65 | +| v1 | v2 | |
| 66 | +|---|---| |
| 67 | +| `internal/lib/formatting` | `internal/formatting` | |
| 68 | + |
| 69 | +## Accounting |
| 70 | + |
| 71 | +27 `modules/` packages = 6 collapsed into core + 15 standalone submodules + 6 removed. Plus 2 removed `cmd/` binaries and 1 internal flatten. Submodule count: 16. |
| 72 | + |
| 73 | +## Open decisions |
| 74 | + |
| 75 | +None. The map is frozen. |
| 76 | + |
| 77 | +## Resolved |
| 78 | + |
| 79 | +- **`oci`** (Oracle Cloud Infrastructure): not carried forward to v2. Niche provider; removed alongside the other dropped packages. Oracle Cloud users stay on frozen v1. |
| 80 | +- **Renames.** Decided to rename the three hyphenated packages at the v2 boundary: `http-helper` -> `httphelper`, `dns-helper` -> `dnshelper`, `test-structure` -> `teststructure`. Consumers already rewrite every import for the `/v2` bump, so folding the rename into that same edit adds no separate migration, and it drops the non-idiomatic underscore package names (`http_helper`, currently suppressed with `//nolint:staticcheck`). The rename rides along with the modularization import rewrite, and the codemod covers both the path and the package identifier. |
0 commit comments