diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix index b478071ead1678..d8c17a89e69b62 100644 --- a/pkgs/applications/networking/cluster/terraform/default.nix +++ b/pkgs/applications/networking/cluster/terraform/default.nix @@ -1,15 +1,13 @@ -{ stdenv, lib, buildEnv, buildGoPackage, fetchFromGitHub, makeWrapper, coreutils +{ stdenv, lib, buildGoModule, fetchFromGitHub, makeWrapper, coreutils , runCommand, runtimeShell, writeText, terraform-providers, fetchpatch }: let - goPackagePath = "github.com/hashicorp/terraform"; - - generic = { version, sha256, ... }@attrs: - let attrs' = builtins.removeAttrs attrs [ "version" "sha256" ]; - in buildGoPackage ({ + generic = { version, sha256, vendorSha256 ? null, ... }@attrs: + let attrs' = builtins.removeAttrs attrs [ "version" "sha256" "vendorSha256" ]; + in buildGoModule ({ name = "terraform-${version}"; - inherit goPackagePath; + inherit vendorSha256; src = fetchFromGitHub { owner = "hashicorp"; @@ -18,7 +16,7 @@ let inherit sha256; }; - postPatch = '' + postConfigure = '' # speakeasy hardcodes /bin/stty https://github.com/bgentry/speakeasy/issues/22 substituteInPlace vendor/github.com/bgentry/speakeasy/speakeasy_unix.go \ --replace "/bin/stty" "${coreutils}/bin/stty" @@ -34,9 +32,12 @@ let ''; preCheck = '' - export HOME=$TMP + export HOME=$TMPDIR + export TF_SKIP_REMOTE_TESTS=1 ''; + subPackages = [ "." ]; + meta = with stdenv.lib; { description = "Tool for building, changing, and versioning infrastructure"; @@ -163,6 +164,14 @@ in rec { passthru = { inherit plugins; }; }); + terraform_0_14 = pluggable (generic { + version = "0.14.0"; + sha256 = "0pbglnvb6cx8zrz791lfa67dmjqfsyysbxm2083b1lhlmbybi9ax"; + vendorSha256 = "1gxhdj98np482jm76aj6zbbmkn7vfk8b878hzz59iywgbdr1r4m1"; + patches = [ ./provider-path.patch ]; + passthru = { inherit plugins; }; + }); + # Tests that the plugins are being used. Terraform looks at the specific # file pattern and if the plugin is not found it will try to download it # from the Internet. With sandboxing enable this test will fail if that is diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a3c3330ae37681..bb7954388aa6c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28139,6 +28139,7 @@ in terraform_0_11-full terraform_0_12 terraform_0_13 + terraform_0_14 terraform_plugins_test ;