2018-09-28 19:28:38 +01:00
|
|
|
{ lib
|
2020-11-09 22:33:46 +00:00
|
|
|
, buildGoModule
|
2018-09-28 19:28:38 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, callPackage
|
2021-08-10 19:43:24 +01:00
|
|
|
, config
|
2022-01-02 21:15:37 +00:00
|
|
|
|
|
|
|
, cdrtools # libvirt
|
2018-09-28 19:28:38 +01:00
|
|
|
}:
|
2017-09-01 15:49:24 +01:00
|
|
|
let
|
2020-09-30 21:20:18 +01:00
|
|
|
list = lib.importJSON ./providers.json;
|
2017-09-08 19:36:43 +01:00
|
|
|
|
2020-11-09 22:33:46 +00:00
|
|
|
buildWithGoModule = data:
|
|
|
|
buildGoModule {
|
|
|
|
pname = data.repo;
|
2022-01-03 10:46:10 +00:00
|
|
|
inherit (data) vendorSha256 version;
|
2020-11-09 22:33:46 +00:00
|
|
|
subPackages = [ "." ];
|
2021-12-30 07:59:20 +00:00
|
|
|
doCheck = false;
|
2022-01-03 15:10:21 +00:00
|
|
|
# https://github.com/hashicorp/terraform-provider-scaffolding/blob/a8ac8375a7082befe55b71c8cbb048493dd220c2/.goreleaser.yml
|
|
|
|
# goreleaser (used for builds distributed via terraform registry) requires that CGO is disabled
|
|
|
|
CGO_ENABLED = 0;
|
|
|
|
ldflags = [ "-s" "-w" "-X main.version=${data.version}" "-X main.commit=${data.rev}" ];
|
2020-11-09 22:33:46 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit (data) owner repo rev sha256;
|
|
|
|
};
|
2021-08-30 08:40:51 +01:00
|
|
|
deleteVendor = data.deleteVendor or false;
|
2021-12-31 12:30:23 +00:00
|
|
|
proxyVendor = data.proxyVendor or false;
|
2020-11-09 22:33:46 +00:00
|
|
|
|
|
|
|
# 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/${data.repo}{,_v${data.version}}";
|
|
|
|
passthru = data;
|
|
|
|
};
|
|
|
|
|
2021-10-05 18:21:45 +01:00
|
|
|
# Our generic constructor to build new providers
|
|
|
|
mkProvider = attrs:
|
2022-01-03 10:46:10 +00:00
|
|
|
(if (lib.hasAttr "vendorSha256" attrs) then buildWithGoModule else throw /* added 2022/01 */ "vendorSha256 missing: please use `buildGoModule`")
|
2021-10-05 18:21:45 +01:00
|
|
|
attrs;
|
|
|
|
|
|
|
|
# These providers are managed with the ./update-all script
|
|
|
|
automated-providers = lib.mapAttrs (_: attrs: mkProvider attrs) list;
|
2020-03-24 15:03:21 +00:00
|
|
|
|
|
|
|
# These are the providers that don't fall in line with the default model
|
2022-01-03 14:27:34 +00:00
|
|
|
special-providers = let archived = throw "the provider has been archived by upstream"; in {
|
2020-04-26 12:06:38 +01:00
|
|
|
# Packages that don't fit the default model
|
2021-10-05 18:21:45 +01:00
|
|
|
gandi = callPackage ./gandi { };
|
2022-01-02 21:15:37 +00:00
|
|
|
# mkisofs needed to create ISOs holding cloud-init data,
|
|
|
|
# and wrapped to terraform via deecb4c1aab780047d79978c636eeb879dd68630
|
|
|
|
libvirt = automated-providers.libvirt.overrideAttrs (_: { propagatedBuildInputs = [ cdrtools ]; });
|
2021-10-28 17:09:13 +01:00
|
|
|
teleport = callPackage ./teleport { };
|
2021-10-05 18:21:45 +01:00
|
|
|
vpsadmin = callPackage ./vpsadmin { };
|
2021-08-10 19:43:24 +01:00
|
|
|
} // (lib.optionalAttrs (config.allowAliases or false) {
|
2022-01-02 12:02:00 +00:00
|
|
|
arukas = archived; # added 2022/01
|
|
|
|
bitbucket = archived; # added 2022/01
|
|
|
|
chef = archived; # added 2022/01
|
|
|
|
cherryservers = archived; # added 2022/01
|
|
|
|
clc = archived; # added 2022/01
|
2022-01-02 02:21:10 +00:00
|
|
|
cloudstack = throw "removed from nixpkgs"; # added 2022/01
|
2022-01-02 12:02:00 +00:00
|
|
|
cobbler = archived; # added 2022/01
|
|
|
|
cohesity = archived; # added 2022/01
|
|
|
|
dyn = archived; # added 2022/01
|
|
|
|
genymotion = archived; # added 2022/01
|
|
|
|
hedvig = archived; # added 2022/01
|
|
|
|
ignition = archived; # added 2022/01
|
|
|
|
incapsula = archived; # added 2022/01
|
|
|
|
influxdb = archived; # added 2022/01
|
|
|
|
jdcloud = archived; # added 2022/01
|
2021-08-10 19:43:24 +01:00
|
|
|
kubernetes-alpha = throw "This has been merged as beta into the kubernetes provider. See https://www.hashicorp.com/blog/beta-support-for-crds-in-the-terraform-provider-for-kubernetes for details";
|
2022-01-02 12:02:00 +00:00
|
|
|
librato = archived; # added 2022/01
|
|
|
|
logentries = archived; # added 2022/01
|
|
|
|
metalcloud = archived; # added 2022/01
|
|
|
|
mysql = archived; # added 2022/01
|
|
|
|
nixos = archived; # added 2022/01
|
|
|
|
oneandone = archived; # added 2022/01
|
|
|
|
packet = archived; # added 2022/01
|
|
|
|
profitbricks = archived; # added 2022/01
|
|
|
|
pureport = archived; # added 2022/01
|
|
|
|
rancher = archived; # added 2022/01
|
|
|
|
rightscale = archived; # added 2022/01
|
|
|
|
runscope = archived; # added 2022/01
|
2022-01-02 02:23:12 +00:00
|
|
|
segment = throw "removed from nixpkgs"; # added 2022/01
|
2022-01-02 12:02:00 +00:00
|
|
|
softlayer = archived; # added 2022/01
|
|
|
|
telefonicaopencloud = archived; # added 2022/01
|
|
|
|
terraform = archived; # added 2022/01
|
|
|
|
ultradns = archived; # added 2022/01
|
2022-01-02 02:22:36 +00:00
|
|
|
vthunder = throw "provider was renamed to thunder"; # added 2022/01
|
2021-08-10 19:43:24 +01:00
|
|
|
});
|
2020-03-24 15:03:21 +00:00
|
|
|
in
|
2021-10-05 18:21:45 +01:00
|
|
|
automated-providers // special-providers // { inherit mkProvider; }
|