GithubHelp home page GithubHelp logo

hackworthltd / nixpkgs-terraform-providers-bin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nix-community/nixpkgs-terraform-providers-bin

0.0 0.0 0.0 3.57 MB

auto-updating terraform providers for nix [maintainer=@zimbatm]

License: MIT License

Shell 1.62% Ruby 15.32% Nix 81.51% HCL 1.55%

nixpkgs-terraform-providers-bin's Introduction

nixpkgs-terraform-providers-bin

STATUS: stable

This project provides a daily snapshot of the latest terraform providers from https://registry.terraform.io/browse/providers packaged with Nix.

It's useful if your project is using terraform.withPlugins and is stuck on an old nixpkgs channel. This project allows you to mix-and-match providers as needed.

Features

  • automatically updated daily
  • compatible with terraform.withPlugins
  • supports holding multiple providers with the same name

Usage

This is a Nix project, that you import using either niv or Nix Flakes.

The top-level default.nix enforces a 1:1 mapping with the hashicorp registry. For example https://registry.terraform.io/providers/hashicorp/aws maps to the providers.hashicorp.aws attribute.

Eg:

$ example/example.nix as nix

{ nixpkgs, nixpkgs-terraform-providers-bin }:
let
  # Create a wrapper of terraform that has access to only the declared list of
  # providers. Mixed-and-matched from both nixpkgs and this project.
  my_terraform = nixpkgs.terraform.withPlugins (p: [
    # The providers coming from nixpkgs have a flat namespace
    p.random
    p.null

    # The providers coming from nixpkgs-terraform-providers-bin have a 1:1
    # mapping with the terraform registry, replacing `/` with `.`:
    # https://registry.terraform.io/providers/hashicorp/nomad
    nixpkgs-terraform-providers-bin.providers.hashicorp.nomad
  ]);
in
# Here we create a trivial shell with only that wrapper
nixpkgs.mkShell {
  packages = [
    my_terraform
  ];
}

Niv

Here is how to import the project with niv:

$ niv add nix-community/nixpkgs-terraform-providers-bin

Then import the provider in your nix code. This is glue code and can be arranged in various ways:

$ example/shell.nix as nix

{ system ? builtins.currentSystem }:
let
  # Dependencies managed by Niv
  sources = import ./nix/sources.nix;

  nixpkgs = import sources.nixpkgs {
    inherit system;
  };

  nixpkgs-terraform-providers-bin = import sources.nixpkgs-terraform-providers-bin {
    # Pass an instance of nixpkgs to this repo.
    inherit nixpkgs;
  };
in
import ./example.nix {
  inherit nixpkgs nixpkgs-terraform-providers-bin;
}

Flakes

Pretty much the same as above but using nixpkgs-terraform-providers-bin.legacyPackages.${system} instead of nixpkgs-terraform-providers-bin:

For example:

$ example/flake.nix as nix

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs-terraform-providers-bin.url = "github:nix-community/nixpkgs-terraform-providers-bin";
    nixpkgs-terraform-providers-bin.inputs.nixpkgs.follows = "nixpkgs";
  };
  outputs = { self, nixpkgs, flake-utils, nixpkgs-terraform-providers-bin }@inputs:
    flake-utils.lib.eachDefaultSystem (system:
      {
        devShells.default = import ./example.nix {
          nixpkgs = nixpkgs.legacyPackages.${system};
          nixpkgs-terraform-providers-bin = nixpkgs-terraform-providers-bin.legacyPackages.${system};
        };
      }
    );
}

Maintenance

Updating providers

The CI does a daily run of the script below, and then pushes the changes back to the master branch.

$ ./update.rb

Adding new providers

By default, we included all the providers that are in nixpkgs, and the "official" providers from https://registry.terraform.io/browse/providers?tier=official

If there is another provider that you want to see added to the list, feel free to send a PR after running this:

$ mkdir -p providers/<owner>/<provider-name>
$ ./update.rb <owner>/<provider-name>

Contributing

Contributions are welcome. By sending PRs, you agree to license your work under the same license as this repository.

This project has been created and is maintained by Numtide.

NumTide Logo

License

Copyright Numtide and contributors and licensed under the MIT.

nixpkgs-terraform-providers-bin's People

Contributors

alexnuttinck avatar alisonjenkins avatar dependabot[bot] avatar dhess avatar github-actions[bot] avatar jfroche avatar johnalotoski avatar manveru avatar maskedbelgian avatar nevesenin avatar roberth avatar senorsmile avatar terlar avatar tolbrino avatar zimbatm avatar zowoq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.