@@ -1,15 +1,13 @@
1−{ stdenv, lib, buildEnv, buildGoPackage, fetchFromGitHub, makeWrapper, coreutils
1+{ stdenv, lib, buildGoModule, fetchFromGitHub, makeWrapper, coreutils
22, runCommand, runtimeShell, writeText, terraform-providers, fetchpatch }:
33
44let
5− goPackagePath = "github.com/hashicorp/terraform";
6−
7− generic = { version, sha256, ... }@attrs:
8− let attrs' = builtins.removeAttrs attrs [ "version" "sha256" ];
9− in buildGoPackage ({
5+ generic = { version, sha256, vendorSha256 ? null, ... }@attrs:
6+ let attrs' = builtins.removeAttrs attrs [ "version" "sha256" "vendorSha256" ];
7+ in buildGoModule ({
108 name = "terraform-${version}";
119
12− inherit goPackagePath;
10+ inherit vendorSha256;
1311
1412 src = fetchFromGitHub {
1513 owner = "hashicorp";
@@ -18,7 +16,7 @@ let
1816 inherit sha256;
1917 };
2018
21− postPatch = ''
19+ postConfigure = ''
2220 # speakeasy hardcodes /bin/stty https://github.com/bgentry/speakeasy/issues/22
2321 substituteInPlace vendor/github.com/bgentry/speakeasy/speakeasy_unix.go \
2422 --replace "/bin/stty" "${coreutils}/bin/stty"
@@ -34,9 +32,12 @@ let
3432 '';
3533
3634 preCheck = ''
37− export HOME=$TMP
35+ export HOME=$TMPDIR
36+ export TF_SKIP_REMOTE_TESTS=1
3837 '';
3938
39+ subPackages = [ "." ];
40+
4041 meta = with stdenv.lib; {
4142 description =
4243 "Tool for building, changing, and versioning infrastructure";
@@ -163,6 +164,14 @@ in rec {
163164 passthru = { inherit plugins; };
164165 });
165166
167+ terraform_0_14 = pluggable (generic {
168+ version = "0.14.0";
169+ sha256 = "0pbglnvb6cx8zrz791lfa67dmjqfsyysbxm2083b1lhlmbybi9ax";
170+ vendorSha256 = "1gxhdj98np482jm76aj6zbbmkn7vfk8b878hzz59iywgbdr1r4m1";
171+ patches = [ ./provider-path.patch ];
172+ passthru = { inherit plugins; };
173+ });
174+
166175 # Tests that the plugins are being used. Terraform looks at the specific
167176 # file pattern and if the plugin is not found it will try to download it
168177 # from the Internet. With sandboxing enable this test will fail if that is