;;; Copyright © 2020 Collin J. Doering ;;; ;;; This file is part of the GNU Guix channel rekahsoft-guix ;;; ;;; The rekahsoft-guix channel for GNU Guix is free software; you can ;;; redistribute it and/or modify it under the terms of the GNU General Public ;;; License as published by the Free Software Foundation; either version 3 of ;;; the License, or (at your option) any later version. ;;; ;;; The rekahsoft-guix channel for GNU Guix is distributed in the hope that it ;;; will be useful, but WITHOUT ANY WARRANTY; without even the implied ;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License along ;;; with the rekahsoft-guix channel for GNU Guix. If not, see ;;; . (define-module (rekahsoft-gnu packages terraform) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (gnu packages golang) #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system go) #:use-module (guix build-system trivial) #:use-module (rekahsoft-gnu packages golang)) (define (search-rekahsoft-gnu-patches patch) (parameterize ((%patch-path (map (lambda (directory) (string-append directory "/rekahsoft-gnu/packages/patches")) %load-path))) (search-patches patch))) ;; TODO: Uses vendored dependencies (define-public terraform-0.13 (package (name "terraform") (version "0.13.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/hashicorp/terraform") (commit (string-append "v" version)))) (patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch")) (file-name (git-file-name name version)) (sha256 (base32 "0a4f32g6irmjnfqa8p0ydnlk1hk2749ifp4r7dalxl4687qzxz17")))) (build-system go-build-system) (native-inputs `(("go-gox" ,go-github-com-mitchellh-gox))) (native-search-paths (list (search-path-specification (variable "SSL_CERT_DIR") (separator #f) ;single entry (files '("etc/ssl/certs"))) (search-path-specification (variable "SSL_CERT_FILE") (file-type 'regular) (separator #f) ;single entry (files '("etc/ssl/certs/ca-certificates.crt"))) (search-path-specification (variable "GUIX_TERRAFORM_PLUGIN_DIR") (separator #f) ;single entry (files '("libexec/terraform"))))) (arguments `(#:import-path "github.com/hashicorp/terraform" #:install-source? #f #:modules ((guix build go-build-system) (guix build utils) (srfi srfi-1)) #:phases (modify-phases %standard-phases (replace 'build (lambda _ (with-directory-excursion "src/github.com/hashicorp/terraform" (setenv "TF_RELEASE" "") (setenv "XC_OS" "linux") (setenv "XC_ARCH" (let ((system ,(or (%current-target-system) (%current-system)))) (cond ((string-prefix? "x86_64" system) "amd64") ((string-prefix? "i686" system) "386") (else "")))) (invoke "./scripts/build.sh")))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (version (last (string-split out #\-))) (components (string-split version #\.)) (major+minor (take components 2)) (executable (string-append "terraform-" (string-join major+minor ".")))) (with-directory-excursion "src/github.com/hashicorp/terraform/bin" (rename-file "terraform" executable) (install-file executable bin) #t))))))) (synopsis "Safely and predictably create, change, and improve infrastructure") (description "Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.") (home-page "https://github.com/hashicorp/terraform") (license license:mpl2.0))) (define-public terraform-0.12 (package/inherit terraform-0.13 (name "terraform") (version "0.12.31") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/hashicorp/terraform") (commit (string-append "v" version)))) (patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch")) (file-name (git-file-name name version)) (sha256 (base32 "03p698xdbk5gj0f9v8v1fpd74zng3948dyy4f2hv7zgks9hid7fg")))))) (define-public terraform-0.11 (package/inherit terraform-0.13 (name "terraform") (version "0.11.15") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/hashicorp/terraform") (commit (string-append "v" version)))) (patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch")) (file-name (git-file-name name version)) (sha256 (base32 "15qs7zwz18cmp8xnkf9rwqmracy7va1n480apxiaijrgvai8sv8n")))))) (define* (wrap-terraform terraform #:optional (name (string-append (package-name terraform) "-wrapper"))) (package/inherit terraform (name name) (source #f) (build-system trivial-build-system) (outputs '("out")) (propagated-inputs `(("terraform" ,terraform))) (arguments `(#:modules ((guix build utils) (srfi srfi-1)) #:builder (begin (use-modules (guix build utils) (srfi srfi-1)) (let* ((out (assoc-ref %outputs "out")) (bin (string-append out "/bin")) (terraform (string-append (assoc-ref %build-inputs "terraform") "/bin/")) (version (last (string-split out #\-))) (components (string-split version #\.)) (major+minor (take components 2))) (mkdir-p bin) (symlink (string-append terraform "terraform-" (string-join major+minor ".")) (string-append bin "/" "terraform")) #t)))) (synopsis "Wrapper for terraform commands") (description "This package provides wrappers for the commands of Terraform@tie{}MAJOR.MINOR.x such that they can be invoked under their usual name---e.g., @command{terraform} instead of @command{terraform-MAJOR.MINOR}."))) (define-public terraform-wrapper-0.13 (wrap-terraform terraform-0.13)) (define-public terraform-wrapper-0.12 (wrap-terraform terraform-0.12)) (define-public terraform-wrapper-0.11 (wrap-terraform terraform-0.11)) (define terraform-provider-phases '(modify-phases %standard-phases (add-after 'remove-go-references 'change-out (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (original-path (string-append out "/bin")) (install-path (string-append out "/libexec/terraform"))) (mkdir-p install-path) (copy-recursively original-path install-path) (delete-file-recursively original-path)))))) (define (make-terraform-provider package) (package/inherit package (arguments (substitute-keyword-arguments (package-arguments package) ((#:phases phases '%standard-phases) `(modify-phases ,phases (delete 'change-out) ; Delete phase if it already exists (add-after 'install 'change-out (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (tf-provider-name ,(package-name package)) (tf-provider-name+version (string-append tf-provider-name "_v" ,(package-version package))) (libexec (string-append out "/libexec/terraform"))) (mkdir-p libexec) (rename-file (string-append bin "/" tf-provider-name) (string-append libexec "/" tf-provider-name+version)) (delete-file-recursively bin)))))))))) (define-public terraform-provider-aws (make-terraform-provider (package (name "terraform-provider-aws") (version "2.70.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-aws") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1swmkyi8yv1rpkzn283lm9kqjyzscvjfzm8smn0sxcniwx7002js")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-aws" #:install-source? #f)) (synopsis "@command{Terraform} AWS provider") (description "Terraform AWS provider.") (home-page "https://github.com/terraform-providers/terraform-provider-aws") (license license:mpl2.0)))) (define-public terraform-provider-template (make-terraform-provider (package (name "terraform-provider-template") (version "2.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-template") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "12pn1i06jz4xl50md94yfdggg3pg5bv1viwf35izizm5rnyksyv2")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-template" #:install-source? #f)) (synopsis "@command{Terraform} AWS provider") (description "Terraform template provider.") (home-page "https://github.com/terraform-providers/terraform-provider-template") (license license:mpl2.0)))) (define-public terraform-provider-google (make-terraform-provider (package (name "terraform-provider-google") (version "2.8.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-google") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1r4x7l20w8wb6a356vx71lra466p7hfww1jyv0bg7z1f015qs91l")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-google" #:install-source? #f)) (synopsis "Terraform Google Cloud Platform provider ") (description "Terraform Google Cloud Platform provider.") (home-page "https://github.com/terraform-providers/terraform-provider-google") (license license:mpl2.0)))) (define-public terraform-provider-kubernetes (make-terraform-provider (package (name "terraform-provider-kubernetes") (version "1.7.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-kubernetes") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0fah2310hic2svjfya3051sv8sp5gwgrfc1y2ggdn66hjz0x6ir3")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-kubernetes" #:install-source? #f)) (synopsis "Terraform Kubernetes provider ") (description "Terraform Kubernetes provider.") (home-page "https://github.com/terraform-providers/terraform-provider-kubernetes") (license license:mpl2.0)))) (define-public terraform-provider-azurerm (make-terraform-provider (package (name "terraform-provider-azurerm") (version "1.30.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-azurerm") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0zxvj6k1xs151dik8yhjl31r563dsc7iykv32g10w5szyigvxqfd")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-azurerm" #:install-source? #f)) (synopsis "Terraform Azure Resource Manager provider") (description "Terraform Azure Resource Manager provider.") (home-page "https://github.com/terraform-providers/terraform-provider-azurerm") (license license:mpl2.0)))) (define-public terraform-provider-alicloud (make-terraform-provider (package (name "terraform-provider-alicloud") (version "1.46.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-alicloud") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0cndsc0k7mk5xmaakszbl680igxfvxzlcnrfr07qz6bk796p9sfp")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-alicloud" #:install-source? #f)) (synopsis "Terraform Alicloud provider") (description "Terraform Alicloud provider.") (home-page "https://github.com/terraform-providers/terraform-provider-alicloud") (license license:mpl2.0)))) (define-public terraform-provider-vsphere (make-terraform-provider (package (name "terraform-provider-vsphere") (version "1.11.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-vsphere") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "02qkm8n0z8v8xfjkvy5nkjc4p37xqp5xsds10b3b060vb5l6yfg4")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-vsphere" #:install-source? #f)) (synopsis "Terraform Vsphere provider") (description "Terraform Vsphere provider.") (home-page "https://github.com/terraform-providers/terraform-provider-vsphere") (license license:mpl2.0)))) (define-public terraform-provider-cloudflare (make-terraform-provider (package (name "terraform-provider-cloudflare") (version "1.15.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-cloudflare") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0mb771dw5fw2s6jd63sybwza49axyj9967fl454m3sznhpl96y8z")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-cloudflare" #:install-source? #f)) (synopsis "Terraform Cloudflare provider") (description "Terraform Cloudflare provider.") (home-page "https://github.com/terraform-providers/terraform-provider-cloudflare") (license license:mpl2.0)))) (define-public terraform-provider-vault (make-terraform-provider (package (name "terraform-provider-vault") (version "1.9.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-vault") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "19ckfm89877s7jp8vssph9mdjr3srq4m6kc2zn2ky979775bi5lw")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-vault" #:install-source? #f)) (synopsis "Terraform Vault provider") (description "Terraform Vault provider.") (home-page "https://github.com/terraform-providers/terraform-provider-vault") (license license:mpl2.0)))) (define-public terraform-provider-gitlab (make-terraform-provider (package (name "terraform-provider-gitlab") (version "1.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-gitlab") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "11j84kyw2lsqsn6ya070hx0k6igb3hhjl8zlnr4q3gpmv51y23qc")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-gitlab" #:install-source? #f)) (synopsis "Terraform Gitlab provider") (description "Terraform Gitlab provider.") (home-page "https://github.com/terraform-providers/terraform-provider-gitlab") (license license:mpl2.0)))) (define-public terraform-provider-github (make-terraform-provider (package (name "terraform-provider-github") (version "2.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-github") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "05ca0vw6s7q40zcs50mr6k2swwx3a3njd4dxdz00qki58hgb87y6")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-github" #:install-source? #f)) (synopsis "Terraform Github provider") (description "Terraform Github provider.") (home-page "https://github.com/terraform-providers/terraform-provider-github") (license license:mpl2.0)))) (define-public terraform-provider-digitalocean (make-terraform-provider (package (name "terraform-provider-digitalocean") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-digitalocean") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1x55clpy3i2jrnmdwlya82vd3aiyvrzpx5y57xjs29x232cygw7r")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-digitalocean" #:install-source? #f)) (synopsis "Terraform Digitalocean provider") (description "Terraform Digitalocean provider.") (home-page "https://github.com/terraform-providers/terraform-provider-digitalocean") (license license:mpl2.0)))) (define-public terraform-provider-helm (make-terraform-provider (package (name "terraform-provider-helm") (version "0.9.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-helm") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1bni05ski94w3ihhf0jp3mk8dzkbm9jlgv6xb23403ppcbgy7s9d")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-helm" #:install-source? #f)) (synopsis "Terraform Helm provider") (description "Terraform Helm provider.") (home-page "https://helm.com/terraform-providers/terraform-provider-helm") (license license:mpl2.0)))) (define-public terraform-provider-linode (make-terraform-provider (package (name "terraform-provider-linode") (version "1.6.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-linode") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0i2x0jd26qanziihlc38s7rxiab66ld2s5gz18rrmrbwhcl95fwj")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-linode" #:install-source? #f)) (synopsis "Terraform Linode provider") (description "Terraform Linode provider.") (home-page "https://github.com/terraform-providers/terraform-provider-linode") (license license:mpl2.0)))) (define-public terraform-provider-random (make-terraform-provider (package (name "terraform-provider-random") (version "2.1.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-random") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "102bgd8s9yhm2ny2akv04mhwf5mphqhsxx9vxjbg7ygqnz9ka5nw")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-random" #:install-source? #f)) (synopsis "Terraform random provider") (description "Terraform Random provider.") (home-page "https://github.com/terraform-providers/terraform-provider-random") (license license:mpl2.0)))) (define-public terraform-provider-null (make-terraform-provider (package (name "terraform-provider-null") (version "3.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-null") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0s6j2py9bb3knrn0f8aga8ypkxj6v5ns08k7zgw26h3wwdxwyd12")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-null" #:install-source? #f)) (synopsis "Terraform null provider") (description "Terraform null provider.") (home-page "https://github.com/terraform-providers/terraform-provider-null") (license license:mpl2.0)))) (define-public terraform-provider-null-2.1 (make-terraform-provider (package/inherit terraform-provider-null (name "terraform-provider-null") (version "2.1.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-null") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0di1hxmd3s80sz8hl5q2i425by8fbk15f0r4jmnm6vra0cq89jw2")))) (description "Terraform null provider. Supports terraform => 0.11.")))) (define-public terraform-provider-heroku (make-terraform-provider (package (name "terraform-provider-heroku") (version "2.0.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-heroku") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "161pc6s4ifzi58cx32sdk9nan4kz6gn3mch1pnmp03f6390s2pcm")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-heroku" #:install-source? #f)) (synopsis "Terraform heroku provider") (description "Terraform Heroku provider.") (home-page "https://github.com/terraform-providers/terraform-provider-heroku") (license license:mpl2.0)))) (define-public terraform-provider-nomad (make-terraform-provider (package (name "terraform-provider-nomad") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-nomad") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "04dh7gas6viny6bkx89fkwmxrw101b8bmw14m2mzfkxn70cl2na4")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-nomad" #:install-source? #f)) (synopsis "Terraform nomad provider") (description "Terraform Nomad provider.") (home-page "https://github.com/terraform-providers/terraform-provider-nomad") (license license:mpl2.0)))) (define-public terraform-provider-postgresql (make-terraform-provider (package (name "terraform-provider-postgresql") (version "0.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-postgresql") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0fywq1vzm8fcd0jcvzx1n3jilrk0r6ylqz9r4dwsyc64iqvmrpps")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-postgresql" #:install-source? #f)) (synopsis "Terraform postgresql provider") (description "Terraform Postgresql provider.") (home-page "https://github.com/terraform-providers/terraform-provider-postgresql") (license license:mpl2.0)))) (define-public terraform-provider-grafana (make-terraform-provider (package (name "terraform-provider-grafana") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-grafana") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1y41yhp82phgw83frkgrjzpymsys2abvdwa1n905rz7i15ybasqc")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-grafana" #:install-source? #f)) (synopsis "Terraform grafana provider") (description "Terraform Grafana provider.") (home-page "https://github.com/terraform-providers/terraform-provider-grafana") (license license:mpl2.0)))) (define-public terraform-provider-docker (make-terraform-provider (package (name "terraform-provider-docker") (version "1.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-docker") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1w69kjlrgy4397c9nz3llqsqcjzchwqw1ksw4wg34xnnq20pd4ql")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-docker" #:install-source? #f)) (synopsis "Terraform docker provider") (description "Terraform Docker provider.") (home-page "https://github.com/terraform-providers/terraform-provider-docker") (license license:mpl2.0)))) (define-public terraform-provider-openstack (make-terraform-provider (package (name "terraform-provider-openstack") (version "1.19.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/terraform-providers/terraform-provider-openstack") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1y9b9h523zflq4z9cwjgfa0l92j4ac5pc1r6vja1aw3gg2ln80x9")))) (build-system go-build-system) (arguments `(#:import-path "github.com/terraform-providers/terraform-provider-openstack" #:install-source? #f)) (synopsis "Terraform openstack provider") (description "Terraform Openstack provider.") (home-page "https://github.com/terraform-providers/terraform-provider-openstack") (license license:mpl2.0))))