auto-updating terraform providers for nix [maintainer=@zimbatm]
Find a file
2025-12-30 01:05:29 +00:00
.github build(deps): bump actions/checkout from 5 to 6 (#89) 2025-11-24 16:42:07 +01:00
example chore: autopublish 2022-08-30T01:04:01Z 2022-08-30 01:04:01 +00:00
providers chore: autopublish 2025-12-30T01:05:29Z 2025-12-30 01:05:29 +00:00
test/file wrapTerraform: mark as deprecated 2022-06-16 10:59:07 +02:00
.gitignore make it work 2021-08-29 17:59:57 +02:00
ci.sh write the examples as code to make sure they work 2022-08-26 17:21:50 +02:00
default.nix Make mkTerraformProvider overridable (#73) 2025-01-02 10:02:31 +01:00
flake.lock flake: remove flake-utils (#33) 2023-02-03 10:29:19 +01:00
flake.lock.nix write the examples as code to make sure they work 2022-08-26 17:21:50 +02:00
flake.nix flake: remove flake-utils (#33) 2023-02-03 10:29:19 +01:00
LICENSE Create LICENSE 2021-05-10 18:34:36 +02:00
overlay.nix add overlay for overlay users 2022-04-13 11:35:04 +02:00
README.md README: repo -> provider-name 2022-11-22 19:02:10 +01:00
release.nix store providers as JSON (#16) 2022-06-16 18:41:57 +02:00
shell.nix update nix-shell for flakes (#21) 2022-08-29 19:55:59 +02:00
update.rb update.rb: add final newlines to json (#22) 2022-09-13 14:59:39 +02:00

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.