diff options
author | Timothy Stott <stott.timothy@gmail.com> | 2020-10-05 23:52:33 +0100 |
---|---|---|
committer | Timothy Stott <stott.timothy@gmail.com> | 2020-10-08 22:18:12 +0100 |
commit | cd1b59476793278191c37572c8081b856512eec4 (patch) | |
tree | a6da249b3383aba1dec8d8e189d25856ff5c5197 /pkgs/applications/networking/cluster/terraform-providers | |
parent | 72cd428dd20d6407ebceec9cb8bedaef908e56e4 (diff) |
terraform: expose providers to terraform 0.13
Terraform 0.13 adopts a new filesystem layout for plugins (illustrated below).
Terraform 0.12 and earlier
`plugins-dir/terraform-provider-aws_v3.7.0`
Terraform 0.13
`plugins-dir/registry.terraform.io/hashicorp/aws/3.7.0/linux_amd64/terraform-provider-aws_v3.7.0`
To support all packaged Terraform versions a shim is created at both locations.
This approach was inspired by https://github.com/numtide/generate-terraform-provider-shim
Terraform 0.13 provider documentation https://www.terraform.io/upgrade-guides/0-13.html#new-filesystem-layout-for-local-copies-of-providers
layout terraform providers filesystem in withPlugins
Diffstat (limited to 'pkgs/applications/networking/cluster/terraform-providers')
-rw-r--r-- | pkgs/applications/networking/cluster/terraform-providers/default.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/applications/networking/cluster/terraform-providers/default.nix b/pkgs/applications/networking/cluster/terraform-providers/default.nix index c70e1b6ae11c..d6426a2314c4 100644 --- a/pkgs/applications/networking/cluster/terraform-providers/default.nix +++ b/pkgs/applications/networking/cluster/terraform-providers/default.nix @@ -2,11 +2,16 @@ , buildGoPackage , fetchFromGitHub , callPackage +, runtimeShell }: let list = lib.importJSON ./providers.json; - toDrv = data: + toDrv = name: data: + let + fallbackProviderSourceAddress = "nixpkgs/${data.owner}/${name}"; + providerSourceAddress = data.provider-source-address or fallbackProviderSourceAddress; + in buildGoPackage rec { inherit (data) owner repo rev version sha256; name = "${repo}-${version}"; @@ -18,6 +23,9 @@ let # Terraform allow checking the provider versions, but this breaks # if the versions are not provided via file paths. postBuild = "mv $NIX_BUILD_TOP/go/bin/${repo}{,_v${version}}"; + passthru = { + inherit providerSourceAddress; + }; }; # Google is now using the vendored go modules, which works a bit differently @@ -48,7 +56,7 @@ let }); # These providers are managed with the ./update-all script - automated-providers = lib.mapAttrs (_: toDrv) list; + automated-providers = lib.mapAttrs (toDrv) list; # These are the providers that don't fall in line with the default model special-providers = { |