Terratest v2 lockstep release. All 16 submodules are tagged at v2.0.0-beta.2.
Breaking changes
Eight functions moved to the module that owns the type they operate on, so teststructure no longer pulls in aws, k8s, packer and ssh (#1877). Signatures and on-disk filenames are unchanged, so every call site is a compile error and go build ./... finds all of them.
| beta.1 | beta.2 |
|---|---|
teststructure.{Save,Load}Ec2KeyPair
| aws.{Save,Load}Ec2KeyPair
|
teststructure.{Save,Load}KubectlOptions
| k8s.{Save,Load}KubectlOptions
|
teststructure.{Save,Load}PackerOptions
| packer.{Save,Load}PackerOptions
|
teststructure.{Save,Load}SSHKeyPair
| ssh.{Save,Load}SSHKeyPair
|
Nothing else moved. RunTestStage, the Terraform helpers, SaveString/LoadString and the generic SaveTestData/LoadTestData all stay put.
Smaller dependency graph
This closes #1875, which reported that the v2 split was undercut by teststructure requiring seven modules and k8s requiring aws for a single call.
| module | beta.1 | beta.2 |
|---|---|---|
teststructure
| 301 | 104 |
k8s
| 259 | 160 |
helm
| 316 | 219 |
go.sum lines. k8s and helm no longer carry any aws-sdk-go-v2 entries; importing teststructure for RunTestStage no longer pulls in the AWS SDK or client-go.
Behaviour changes
Node addresses prefer ExternalIP (#1878). k8s.FindNodeHostnameContextE, and GetServiceEndpoint for a NodePort service, now return the ExternalIP recorded on the Node object when present, falling back to the internal hostname as before. On EKS that is the instance's public IP, so the common path needs no EC2 API call and no ec2:DescribeInstances permission. Verified against a live EKS cluster.
Signatures are unchanged. A new FindNodeHostnameWithOptionsContext[E] consults KubectlOptions.NodePublicIPLookup for clusters that do not advertise an ExternalIP:
options.NodePublicIPLookup = aws.GetPublicIpsOfEc2InstancesContextEKubectlOptions carrying a RestConfig no longer serializes (#1879). MarshalJSON returns k8s.ErrRestConfigNotSerializable rather than dropping the config, which would leave reloaded options with no cluster identity and silently authenticate against the ambient kubeconfig. This already failed before, with an opaque json: unsupported type: transport.WrapperFunc. For staged tests use NewKubectlOptions or NewKubectlOptionsWithInClusterAuth; both round trip intact.
Fixes
core/teststatestops after reporting a fatal error instead of continuing. A marshal failure previously still wrote a zero byte file (#1880)ssh.SaveSSHKeyPairno longer writes the private key to the test log- Saved test data is written
0o600rather than0o644 - Service endpoints are built with
net.JoinHostPort, so IPv6 addresses are bracketed correctly - Malformed AWS provider IDs are rejected instead of panicking
Also
- A CI gate now holds the cross-module dependency graph to an explicit allowlist, and catches stale indirect requires (#1881)
docs/v2-import-map.mdrecords the symbol moves and behaviour changes above (#1882)- Removed the sunset Go Report Card badge (#1876)
Thanks to @wjam for reporting #1875.
Install
go get github.com/gruntwork-io/terratest/modules/aws/v2@v2.0.0-beta.2
Modules
All at github.com/gruntwork-io/terratest/modules/<name>/v2:
core ssh httphelper dnshelper docker packer database opa aws azure gcp k8s helm terraform terragrunt teststructure