3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #47407 from kalbasit/nixpkgs_add-terraform-provider-nixos

terraform: update all providers and move nixos provider under terraform.withPlugins
This commit is contained in:
Jörg Thalheim 2018-09-30 22:33:58 +01:00 committed by GitHub
commit 5547a8b6a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 214 additions and 112 deletions

View file

@ -1,23 +0,0 @@
{ stdenv, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "terraform-provider-nixos-${version}";
version = "0.0.1";
goPackagePath = "github.com/tweag/terraform-provider-nixos";
src = fetchFromGitHub {
owner = "tweag";
repo = "terraform-provider-nixos";
sha256 = "00vz6qjq1pk39iqg4356b8g3c6slla9jifkv2knk46gc9q93q0lf";
rev = "v${version}";
};
# Terraform allow checking the provider versions, but this breaks
# if the versions are not provided via file paths.
postBuild = "mv go/bin/terraform-provider-nixos{,_v${version}}";
meta = with stdenv.lib; {
description = "Terraform plugin for outputting NixOS configuration files from Terraform resources.";
homepage = "https://github.com/tweag/terraform-provider-nixos";
license = licenses.mpl20;
maintainers = with maintainers; [ grahamc ];
};
}

View file

@ -1,11 +1,18 @@
# Generated with ./update-all
{
acme =
{
owner = "terraform-providers";
repo = "terraform-provider-acme";
version = "1.0.1";
sha256 = "1yh0dqmrwa1gqpnzj4mdv9p9081azpcskqjrbmy2lzmn3di2ag3r";
};
alicloud =
{
owner = "terraform-providers";
repo = "terraform-provider-alicloud";
version = "1.10.0";
sha256 = "19lplakpl8dz4a8xw9va86gd774yq4gayq4kzv3pvr62b03a999x";
version = "1.17.0";
sha256 = "1zmywmcgfmx5ccp0qxj912sqymisxdg2s84b4qclfa225hrbaqpn";
};
archive =
{
@ -18,8 +25,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-arukas";
version = "0.1.0";
sha256 = "1msfr0rlzjfds02h35p99d1f541a1fzndjcpgijb41yx74h2v5dl";
version = "1.0.0";
sha256 = "1v8jzns8czy8navdrabsvc9zk1s9vs1718ngjlx9vs13r3bkm2fc";
};
atlas =
{
@ -32,22 +39,29 @@
{
owner = "terraform-providers";
repo = "terraform-provider-aws";
version = "1.30.0";
sha256 = "1si2fm5nm7gad90lf410zwjf2q5kd8mv6nkkbfnfdzkpkchavr95";
version = "1.38.0";
sha256 = "1jhr2l8p7wf7kgr2y0c40n1jb9p2153xkpcp4b2half2vhsh1nwi";
};
azurerm =
{
owner = "terraform-providers";
repo = "terraform-provider-azurerm";
version = "1.12.0";
sha256 = "1avp2vhlj60iw17pw39003p30byms7xvq5lkippm60ak4ky9p51b";
version = "1.15.0";
sha256 = "1pdmj0ww5y2nwxivlf5l886nwd76hpqhwdayab2fp16zyl1qbpfd";
};
azurestack =
{
owner = "terraform-providers";
repo = "terraform-provider-azurestack";
version = "0.2.0";
sha256 = "0s1ga0ga0rbpp552hbq1dfnkpdjvk1c40i7qqnqmm20xlz6k55mb";
version = "0.4.0";
sha256 = "1c9am0v4aq95k1jblc767vykk76dp0d6z2fvy148ag77cy2jgryc";
};
bigip =
{
owner = "terraform-providers";
repo = "terraform-provider-bigip";
version = "0.12.0";
sha256 = "0fmmlx757hph45ffm19zafjfkldg41qkw83vz0jjmvxicza1afbd";
};
bitbucket =
{
@ -74,8 +88,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-circonus";
version = "0.1.0";
sha256 = "0v05g91yg2zh4wczp8mi3hmvwb35z0y9044bwy67nm1l624xlj64";
version = "0.1.1";
sha256 = "05n1q9hc0h31icxsmyi2y60wiwd5fs2hz1dqm3bl6hgh5x3ss1im";
};
clc =
{
@ -88,8 +102,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-cloudflare";
version = "1.1.0";
sha256 = "1rmg7gndhmb1wp0zszhwx9vrax8411iy24yrpkmayjify3vsvdpx";
version = "1.5.0";
sha256 = "0l8bmnxmjr2g3xxw8w0ay91cvs4kzc65wkdwybfahvq9r6mww45n";
};
cloudscale =
{
@ -123,8 +137,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-datadog";
version = "1.1.0";
sha256 = "0ckmjpw9dkj5490kwxamdvnnidnjdgxnb1biqpvwj4139hlcl628";
version = "1.3.0";
sha256 = "0d3xccfkzibjp4jl8irja1cdhppdn3b7nh4wy857zvfxpfhz7aj2";
};
digitalocean =
{
@ -158,8 +172,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-docker";
version = "1.0.0";
sha256 = "09ribvyv02r907pdvyrwaklr14xyvyn14rijslnm16xp8d4waz9h";
version = "1.0.1";
sha256 = "1q5bsdvp47gvpiyqlzgrpxczlh6m9g870pn84ks49xfkwk5izpz6";
};
dyn =
{
@ -193,8 +207,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-github";
version = "1.1.0";
sha256 = "1f0yg2qpr9ffimscy17csh20cq9czkcs96ac79s3kl56f8c95ijm";
version = "1.3.0";
sha256 = "1k7816dbpsjjbm3pa6l0qlrxw5hh8z5iwdr8mp1mp5liidhl6bqs";
};
gitlab =
{
@ -207,8 +221,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-google";
version = "1.16.2";
sha256 = "1d8by6rb4s2dggapcbb4b2g5hf280bjayz9p5q9njgsn83579pnm";
version = "1.18.0";
sha256 = "0zwy1imby0xqvb86a82rdvglipf2sfpi3rmsj72iikp7vi3mqk64";
};
grafana =
{
@ -221,15 +235,15 @@
{
owner = "terraform-providers";
repo = "terraform-provider-hcloud";
version = "1.2.0";
sha256 = "17zrdzvb9hp02710khvh9pwkavp79zy3y2qzaydgmnrbkks4s8cg";
version = "1.3.0";
sha256 = "0sb9pajsy0if18vgw5pllgv8qvb4v7pv65m2f3hfkck2za82ndwb";
};
heroku =
{
owner = "terraform-providers";
repo = "terraform-provider-heroku";
version = "1.2.0";
sha256 = "1w2r0wnfcr9aqij5ckq0apd8az8yzdg704hi1zjb1ggb54v97n31";
version = "1.4.0";
sha256 = "159a9add5v4dj2bry1b85i74q2lb4pjjypkm5hzrbqys6gn2imhn";
};
http =
{
@ -242,8 +256,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-huaweicloud";
version = "1.1.0";
sha256 = "1jsvv5yfxgz998p4wbldbq82hl4ykn1yp21igphl94n3b0jj33dj";
version = "1.2.0";
sha256 = "0r05dfgpzci0lpc2ivbrj6ivib8svbks9612by3w3zakzclpv467";
};
icinga2 =
{
@ -263,15 +277,15 @@
{
owner = "terraform-providers";
repo = "terraform-provider-influxdb";
version = "1.0.1";
sha256 = "0713h50675njnpdy4w1azfq8h6yai40gx6w2fbvw4n59h6jlfny4";
version = "1.0.2";
sha256 = "05l2i0z35x6462mm1inn6jhp1pfi7df6hv52lhcyypk0lv2rgqf9";
};
kubernetes =
{
owner = "terraform-providers";
repo = "terraform-provider-kubernetes";
version = "1.1.0";
sha256 = "1lhdmglc6nd24ss7z41qqbpsiy71ajvixhq4pfiq0b19hwj6awgn";
version = "1.2.0";
sha256 = "0slvhj8f7p27r9v4vb5vjyqpmzlpaji1djzwsxsf247df68mka61";
};
librato =
{
@ -315,6 +329,13 @@
version = "1.1.0";
sha256 = "06alk5vd20wzf493dw8hb80q0sx0kw4j8g1sd0193fhni0k4rflw";
};
netlify =
{
owner = "terraform-providers";
repo = "terraform-provider-netlify";
version = "0.1.0";
sha256 = "1lf66nzqcgzjwvh1lv2jp8gcj6apdanlinci5pri8mgv5r1pv40l";
};
newrelic =
{
owner = "terraform-providers";
@ -350,26 +371,33 @@
version = "1.0.0";
sha256 = "12vpa09xrq8z1pjq0bwzq3889c4fl6c5kvynwqy0z1pdx21m60ha";
};
oci =
{
owner = "terraform-providers";
repo = "terraform-provider-oci";
version = "3.1.1";
sha256 = "0wrvb44gs0c1khvam5lrq53l2889japg7d4nyk2hrpywy9japc8m";
};
oneandone =
{
owner = "terraform-providers";
repo = "terraform-provider-oneandone";
version = "1.2.0";
sha256 = "1lrcy05zklv7vc8653f8cn3jjc9zjjwi488dpaphsmsl1md3m88b";
version = "1.3.0";
sha256 = "0c412nqg3k17124i51nn3ffra6gcll904h37h7hyvz97cdblcncn";
};
opc =
{
owner = "terraform-providers";
repo = "terraform-provider-opc";
version = "1.2.0";
sha256 = "19rfm12w97ccyrzpdw0qlwfn7gh64lqh17kj3cv11y1f731z8rlw";
version = "1.2.1";
sha256 = "0mnvi47kbdwwpfzdlcd1mhd15w5b0ivwxi1a5lvs0zyqf0g0cas8";
};
openstack =
{
owner = "terraform-providers";
repo = "terraform-provider-openstack";
version = "1.7.0";
sha256 = "0sw2kmcsi9sjzi549fj6knida01q0lnpqvc3cpyjyv92f6w4bznn";
version = "1.9.0";
sha256 = "0prmdj78jsyrns876cglfp8a3dbpfl33bwb0dj072flh4yknfrdr";
};
opentelekomcloud =
{
@ -389,8 +417,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-oraclepaas";
version = "1.3.0";
sha256 = "09vsb52cbf2h1rdwfg4xb54gklwgmaxdgjcdq1yx5gxj7lfbdl9v";
version = "1.3.2";
sha256 = "138522cidaiy2akqqblik3w6qnx8zgn70ih7am1sxn13vqm1vlhb";
};
ovh =
{
@ -410,15 +438,15 @@
{
owner = "terraform-providers";
repo = "terraform-provider-pagerduty";
version = "1.1.1";
sha256 = "1dpl6cnii9kzx9lr1f9vndh7w6mfg5kv6az7dq49lhi16sxwwb6a";
version = "1.2.0";
sha256 = "037mdcvpcpjj0dpwg0nny862j631ajhv472a847p2ajgk02bq1wf";
};
panos =
{
owner = "terraform-providers";
repo = "terraform-provider-panos";
version = "1.3.0";
sha256 = "1isnhaszld96zpkcbwkf70nhhwmsl2z3s9868cjsac44b27gsvrq";
version = "1.4.0";
sha256 = "033xpglbn0q805b129kf1ywl13m4pgrkwlvgl347nldysryiasxq";
};
postgresql =
{
@ -438,8 +466,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-profitbricks";
version = "1.3.2";
sha256 = "0mk77n833np6ahm6bzvpg31a0m1qazaipd0vqzccqfkbz78sm3jb";
version = "1.4.0";
sha256 = "1yrmlpqc1bzgs3c8pxhfbscf4anjri6gv6sd8i8rn764z8xhwaff";
};
rabbitmq =
{
@ -459,8 +487,15 @@
{
owner = "terraform-providers";
repo = "terraform-provider-random";
version = "1.3.1";
sha256 = "0zcvw0vz7mxx46m2jamhmkl7l0k8v0q5fha5z6cra3y2ikhqrnfl";
version = "2.0.0";
sha256 = "0plg139pbvqwbs5hcl7d5kjn7vwknjr4n0ysc2j5s25iyhikkv9s";
};
rightscale =
{
owner = "terraform-providers";
repo = "terraform-provider-rightscale";
version = "1.3.0";
sha256 = "1brzxyd5hg99x75qh0p707lr9cvqpzx2az1swr624w3rzhjl2ygm";
};
rundeck =
{
@ -473,15 +508,15 @@
{
owner = "terraform-providers";
repo = "terraform-provider-runscope";
version = "0.3.0";
sha256 = "1srnnlw94q1av8rzy8753fk4vazv5ldbimgr9gd51vrmpvmlgxas";
version = "0.4.0";
sha256 = "1n3q2hdwvkkn5rphrcl5qfv4ry2mrr13dcjwzhbym2i1nhpxkld0";
};
scaleway =
{
owner = "terraform-providers";
repo = "terraform-provider-scaleway";
version = "1.5.1";
sha256 = "1b42fh7mwj2cx3g16lgp4sw6ca5qqj0mhm6i7qid8agwsga34v0y";
version = "1.6.0";
sha256 = "1ykcakfw0gp239jp4brpjynxzzvlhldfpv12hkgymj22s37n5jnn";
};
softlayer =
{
@ -494,8 +529,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-spotinst";
version = "1.2.0";
sha256 = "09k79xg5cbs4qhxr0b4f42qpxj6j2795z5vmwbxfkirb5bkpqdq1";
version = "1.4.0";
sha256 = "0kb09v18ksh2r4b5k9iv4rzq403zk1shpakk54pmq8s6i5jd085g";
};
statuscake =
{
@ -525,12 +560,19 @@
version = "1.0.2";
sha256 = "1aj6g6l68n9kqmxfjlkwwxnac7fhha6wrmvsw4yylf0qyssww75v";
};
tfe =
{
owner = "terraform-providers";
repo = "terraform-provider-tfe";
version = "0.2.0";
sha256 = "1d3yiaxmmlnnjmx6vnckvdnqgyxakc9i70dgxdbn8ihw5i6anvik";
};
tls =
{
owner = "terraform-providers";
repo = "terraform-provider-tls";
version = "1.1.0";
sha256 = "1kzq6al9rzpmk98bmxcf5gjx5s28gfjp1xvdsnd4a113pljn0ddb";
version = "1.2.0";
sha256 = "0hvj00j8a820j18yi90xzhd635pkffivp1116d84wyqxya5acd4p";
};
triton =
{
@ -550,8 +592,8 @@
{
owner = "terraform-providers";
repo = "terraform-provider-vault";
version = "1.1.1";
sha256 = "0kiqpnb4669xw9b8nf6a8ky0jhnp14bipaizml3gdh1hnda6hflw";
version = "1.1.4";
sha256 = "00i9rl9pnmicvndkmvcmlj6y80341dmkqnhq09f94yljh1w1zpvv";
};
vcd =
{
@ -564,7 +606,14 @@
{
owner = "terraform-providers";
repo = "terraform-provider-vsphere";
version = "1.6.0";
sha256 = "1xav341bal7lyb206zw2nzgzjvwkda54cgksza44q3jhqznxma47";
version = "1.8.1";
sha256 = "0y6n7mvv1f3jqsxlvf68iq85k69fj7a333203vkvc83dba84aqki";
};
nixos =
{
owner = "tweag";
repo = "terraform-provider-nixos";
version = "0.0.1";
sha256 = "00vz6qjq1pk39iqg4356b8g3c6slla9jifkv2knk46gc9q93q0lf";
};
}

View file

@ -1,4 +1,8 @@
{ lib, buildGoPackage, fetchFromGitHub }:
{ lib
, buildGoPackage
, fetchFromGitHub
, callPackage
}:
let
list = import ./data.nix;
@ -17,4 +21,7 @@ let
postBuild = "mv go/bin/${repo}{,_v${version}}";
};
in
lib.mapAttrs (n: v: toDrv v) list
{
ibm = callPackage ./ibm {};
libvirt = callPackage ./libvirt {};
} // lib.mapAttrs (n: v: toDrv v) list

View file

@ -0,0 +1,13 @@
# lines starting with a # are comments
# The accepted format (double escape all grep expresssions):
# <organisation> [grep-expression] [grep-v-expression] - include all repositories in the organisation.
# grep-expression: filter repo matching the expression
# grep-v-expression: filter repo not matching the expression
# <organisation>/<repo> - include only the named repository.
# include all terraform-providers
terraform-providers terraform-provider- terraform-provider-\\(azure-classic\\|scaffolding\\|google-beta\\)
# include terraform-provider-nixos
tweag/terraform-provider-nixos

View file

@ -4,13 +4,24 @@
#
# This scripts scans the github terraform-providers repo for new releases,
# generates the corresponding nix code and finally generates an index of
# all the providers.
# all the providers given in ./providers.txt.
set -euo pipefail
# the maximum number of attempts before giving up inside of GET and prefetch_github
readonly maxAttempts=30
GET() {
local url=$1
local retry=1
echo "fetching $url" >&2
curl -#fL -u "$GITHUB_AUTH" "$url"
while ! curl -#fL -u "$GITHUB_AUTH" "$url"; do
echo "The curl command has failed. Attempt $retry/${maxAttempts}" >&2
if [[ "${retry}" -eq "${maxAttempts}" ]]; then
exit 1
fi
retry=$(( retry + 1 ))
sleep 5
done
}
get_org_repos() {
@ -24,6 +35,7 @@ get_repo_tags() {
local repo=$2
GET "https://api.github.com/repos/$owner/$repo/git/refs/tags?per_page=100" | \
jq -r '.[].ref' | \
grep -v 'v\.' | \
cut -d '/' -f 3- | \
sort --version-sort
}
@ -32,7 +44,15 @@ prefetch_github() {
local owner=$1
local repo=$2
local rev=$3
nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/$rev.tar.gz"
local retry=1
while ! nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/$rev.tar.gz"; do
echo "The nix-prefetch-url command has failed. Attempt $retry/${maxAttempts}" >&2
if [[ "${retry}" -eq "${maxAttempts}" ]]; then
exit 1
fi
retry=$(( retry + 1 ))
sleep 5
done
}
echo_entry() {
@ -52,6 +72,21 @@ EOF
indent() { sed 's/^/ /'; }
add_repo() {
org="${1}"
repo="${2}"
echo "*** $repo ***"
name=$(echo "$repo" | cut -d - -f 3-)
last_tag=$(get_repo_tags "$org" "$repo" | tail -1)
last_tag_sha256=$(prefetch_github "$org" "$repo" "$last_tag")
{
echo " $name ="
echo_entry "$org" "$repo" "$last_tag" "$last_tag_sha256" | indent
} >> data.nix
}
## Main ##
cd "$(dirname "$0")"
@ -69,29 +104,37 @@ HELP
exit 1
fi
org=terraform-providers
repos=$(get_org_repos "$org" | grep terraform-provider- | grep -v terraform-provider-scaffolding | grep -v terraform-provider-azure-classic | sort)
# Get all the providers with index
cat <<HEADER > data.nix
# Generated with ./update-all
{
HEADER
for repo in $repos; do
echo "*** $repo ***"
name=$(echo "$repo" | cut -d - -f 3-)
last_tag=$(get_repo_tags "$org" "$repo" | tail -1)
last_tag_sha256=$(prefetch_github "$org" "$repo" "$last_tag")
while read line; do
IFS=' ' read -r -a fields <<< "$line"
if [[ "${#fields[@]}" -eq 0 ]]; then
continue
fi
{
echo " $name ="
echo_entry "$org" "$repo" "$last_tag" "$last_tag_sha256" | indent
} >> data.nix
done
if [[ "${fields[0]}" = *"/"* ]]; then
org="$(echo "${fields[0]}" | cut -d/ -f1)"
repo="$(echo "${fields[0]}" | cut -d/ -f2)"
add_repo "${org}" "${repo}"
else
org="${fields[0]}"
repos=$(get_org_repos "$org")
if [[ "${#fields[@]}" -ge 2 ]] && [[ -n "${fields[1]}" ]]; then
repos="$( echo "${repos[@]}" | grep "${fields[1]}" )"
fi
if [[ "${#fields[@]}" -eq 3 ]] && [[ -n "${fields[2]}" ]]; then
repos="$( echo "${repos[@]}" | grep -v "${fields[2]}" )"
fi
repos="$( echo "${repos[@]}" | sort )"
for repo in $repos; do
add_repo "$org" "$repo"
done
fi
done < <(grep -v '^#\|^$' providers.txt)
cat <<FOOTER >> data.nix
}

View file

@ -1,4 +1,11 @@
{ stdenv, lib, buildEnv, buildGoPackage, fetchFromGitHub, makeWrapper }:
{ stdenv
, lib
, buildEnv
, buildGoPackage
, fetchFromGitHub
, makeWrapper
, terraform-providers
}:
let
goPackagePath = "github.com/hashicorp/terraform";
@ -34,7 +41,7 @@ let
description = "Tool for building, changing, and versioning infrastructure";
homepage = https://www.terraform.io/;
license = licenses.mpl20;
maintainers = with maintainers; [ jgeerds zimbatm peterhoeg ];
maintainers = with maintainers; [ jgeerds zimbatm peterhoeg kalbasit ];
};
} // attrs');
@ -75,7 +82,7 @@ let
});
in withPlugins (_: []);
plugins = import ./providers { inherit lib buildGoPackage fetchFromGitHub; };
plugins = removeAttrs terraform-providers ["override" "overrideDerivation" "recurseForDerivations"];
in rec {
terraform_0_8_5 = generic {
version = "0.8.5";

View file

@ -277,6 +277,9 @@ mapAliases ({
telepathy_qt5 = libsForQt5.telepathy; # added 2015-12-19
telepathy_salut = telepathy-salut; # added 2018-02-25
telnet = inetutils; # added 2018-05-15
terraform-provider-ibm = terraform-providers.ibm; # added 2018-09-28
terraform-provider-libvirt = terraform-providers.libvirt; # added 2018-09-28
terraform-provider-nixos = terraform-providers.nixos; # added 2018-09-28
tex-gyre-bonum-math = tex-gyre-math.bonum; # added 2018-04-03
tex-gyre-pagella-math = tex-gyre-math.pagella; # added 2018-04-03
tex-gyre-schola-math = tex-gyre-math.schola; # added 2018-04-03

View file

@ -22120,16 +22120,19 @@ with pkgs;
terraform = terraform_0_11;
terraform-full = terraform_0_11-full;
terraform-providers = recurseIntoAttrs (
callPackage ../applications/networking/cluster/terraform-providers {}
);
terraform-provider-libvirt = callPackage ../applications/networking/cluster/terraform-provider-libvirt {};
terraform-provider-ibm = callPackage ../applications/networking/cluster/terraform-provider-ibm {};
terraform-inventory = callPackage ../applications/networking/cluster/terraform-inventory {};
terraform-provider-nixos = callPackage ../applications/networking/cluster/terraform-provider-nixos {};
terraform-landscape = callPackage ../applications/networking/cluster/terraform-landscape {};
terraform-provider-libvirt = callPackage ../applications/networking/cluster/terraform-provider-libvirt {};
terragrunt = callPackage ../applications/networking/cluster/terragrunt {};
terragrunt_0_11_1 = callPackage ../applications/networking/cluster/terragrunt/0.11.1.nix {