diff options
author | zimbatm <zimbatm@zimbatm.com> | 2018-10-04 22:41:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-04 22:41:19 +0200 |
commit | d4ff6cae34eddbd500009763232f427579ef4481 (patch) | |
tree | 505f10c49a6b958b4d9d48fd950a9b486dd43be0 /pkgs/applications | |
parent | bc46aa9dd296acb7df1301a7cd662072e0e95ecc (diff) | |
download | nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar.gz nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar.bz2 nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar.lz nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar.xz nixlib-d4ff6cae34eddbd500009763232f427579ef4481.tar.zst nixlib-d4ff6cae34eddbd500009763232f427579ef4481.zip |
terraform: add plugins tests (#47861)
I wasn't sure if the plugins were downloaded from the Internet or not. This makes sure that there is no regression in the plugin detection.
Diffstat (limited to 'pkgs/applications')
-rw-r--r-- | pkgs/applications/networking/cluster/terraform/default.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix index 767eb94454d8..a4ffe27102a6 100644 --- a/pkgs/applications/networking/cluster/terraform/default.nix +++ b/pkgs/applications/networking/cluster/terraform/default.nix @@ -4,6 +4,8 @@ , buildGoPackage , fetchFromGitHub , makeWrapper +, runCommand +, writeText , terraform-providers }: @@ -118,4 +120,25 @@ in rec { }); terraform_0_11-full = terraform_0_11.withPlugins lib.attrValues; + + # 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 + # the case. + terraform_plugins_test = let + mainTf = writeText "main.tf" '' + resource "random_id" "test" {} + ''; + terraform = terraform_0_11.withPlugins (p: [ p.random ]); + test = runCommand "terraform-plugin-test" { buildInputs = [terraform]; } + '' + set -e + # make it fail outside of sandbox + export HTTP_PROXY=http://127.0.0.1:0 HTTPS_PROXY=https://127.0.0.1:0 + cp ${mainTf} main.tf + terraform init + touch $out + ''; + in test; + } |