Skip to content

Commit 778e7d2

Browse files
committed
docs: tighten version pinning guide
Drop the "Why pin?" and "Upgrading" sections (the latter duplicated the pin command), inline the unknown-revision error, remove the broken MIGRATION.md link (file moved to the docs site in 20aecba). Roughly halves the page length while preserving the actionable content.
1 parent 5972f7e commit 778e7d2

1 file changed

Lines changed: 6 additions & 31 deletions

File tree

docs/_docs/01_getting-started/version-pinning.md

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,26 @@
22
layout: collection-browser-doc
33
title: Pinning a Terratest version
44
category: getting-started
5-
excerpt: Lock your tests to a known-good Terratest release and upgrade safely.
5+
excerpt: Lock your tests to a specific Terratest release.
66
tags: ["versioning", "go-modules", "pinning"]
77
order: 106
88
nav_title: Documentation
99
nav_title_link: /docs/
1010
---
1111

12-
## Why pin a version?
12+
Pin Terratest if you need reproducible test builds and deliberate control over when you adopt a new release.
1313

14-
Terratest is a Go library, so the version your tests build against is whatever your test module's `go.mod` resolves to. Without an explicit pin, `go get` will pick up the newest published release the next time the module graph is recomputed, which means a regression in a future release can fail builds you did not change. Pinning makes the version a deliberate choice and keeps CI reproducible.
14+
## Pin to a release
1515

16-
Starting with v1.0.0, Terratest follows [semantic versioning](https://semver.org/) and breaking changes only happen in major releases. Pinning is still useful when you want to control _when_ you take a minor or patch bump.
17-
18-
## Pin to a specific release
19-
20-
From the directory that contains your test module's `go.mod`, run:
16+
From the directory that contains your test module's `go.mod`:
2117

2218
```bash
2319
go get github.com/gruntwork-io/terratest@v0.56.0
2420
go mod tidy
2521
```
2622

27-
Replace `v0.56.0` with the release tag you want. See the [Releases page](https://github.com/gruntwork-io/terratest/releases) for the full list. Always commit both `go.mod` and `go.sum` so the pin and its checksums travel with your code. Anyone who runs `go test` against the same `go.mod`/`go.sum` will resolve to the exact same Terratest version.
28-
29-
To downgrade or revert to an earlier release, run the same command with the older tag.
23+
Replace `v0.56.0` with the tag you want from the [Releases page](https://github.com/gruntwork-io/terratest/releases). The same command upgrades, downgrades, or reverts the pin. Always commit `go.mod` and `go.sum` so the pin travels with your code; avoid `@latest` if you need reproducibility.
3024

3125
## Use the root module path
3226

33-
Use the root module path `github.com/gruntwork-io/terratest`, not submodule paths like `github.com/gruntwork-io/terratest/modules/terraform`. Terratest publishes a single Go module at the repository root; submodule-style paths such as `modules/terraform/v0.51.0` are not valid Go module versions and will fail with `unknown revision`:
34-
35-
```text
36-
reading github.com/gruntwork-io/terratest/modules/terraform/go.mod
37-
at revision modules/terraform/v0.51.0: unknown revision
38-
```
39-
40-
If you import individual subpackages in your tests (for example `github.com/gruntwork-io/terratest/modules/terraform`), that is fine. They all resolve through the single root module pin.
41-
42-
## Upgrading
43-
44-
When you are ready to take a newer release, bump the pin explicitly and run the test suite:
45-
46-
```bash
47-
go get github.com/gruntwork-io/terratest@v0.56.0
48-
go mod tidy
49-
go test ./...
50-
```
51-
52-
If a release introduces a regression, revert the pin to the last known-good version and open an issue at [github.com/gruntwork-io/terratest/issues](https://github.com/gruntwork-io/terratest/issues). For history of breaking changes between v0.x and v1.0.0, see [`MIGRATION.md`](https://github.com/gruntwork-io/terratest/blob/main/MIGRATION.md).
27+
Pin `github.com/gruntwork-io/terratest`, not submodule paths like `github.com/gruntwork-io/terratest/modules/terraform`. Terratest publishes a single Go module at the repository root, so submodule-style versions (e.g. `modules/terraform/v0.51.0`) fail with `unknown revision`. Subpackage imports in your test code are fine; they all resolve through the root module pin.

0 commit comments

Comments
 (0)