terraform-providers: add version to patchGoModVendor providers (#97590)

Add version to binaries produced via patchGoModVendor to allow run-time provider
version validation by terraform.

This was initially introduced in 4e63119c54 (terraform: add the version component to terraform provider paths (#34497), 2018-02-06)
but broken in 3e5149a79a (terraform-providers: fix the google and google-beta providers, 2020-03-24)
for terraform-providers.google and terraform-providers.google-beta, and in 20f55a9fc0 (terraform-providers.ibm: move to update-all script, 2020-04-26)
for terraform-providers.ibm.
This commit is contained in:
Maurice B. Lewis 2020-09-27 22:20:41 +00:00 committed by GitHub
parent 4e75022bcf
commit 94d2aeb559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ let
};
# Terraform allow checking the provider versions, but this breaks
# if the versions are not provided via file paths.
postBuild = "mv go/bin/${repo}{,_v${version}}";
postBuild = "mv $NIX_BUILD_TOP/go/bin/${repo}{,_v${version}}";
};
# Google is now using the vendored go modules, which works a bit differently
@ -39,6 +39,8 @@ let
# just build and install into $GOPATH/bin
buildPhase = ''
go install -mod=vendor -v -p 16 .
runHook postBuild
'';
# don't run the tests, they are broken in this setup