terranix is a terraform.json generator with a nix-like-feeling
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
core
doc
playground
.gitignore
README.md
default.nix
lib.nix

README.md

Terranix

A NixOS way to create terraform.json files.

How to use

create a config.nix for example

{ ... }:
{
  resource.hcloud_server.nginx = {
    name = "terranix.nginx";
    image  = "debian-10";
    server_type = "cx11";
    backups = false;
  };
  resource.hcloud_server.test = {
    name = "terranix.test";
    image  = "debian-9";
    server_type = "cx11";
    backups = true;
  };
}

run terranix config.nix and it will output json you can pipe in a file config.tf.json.

How to write modules

You can write modules, like you would in NixOS. Of course you the modules of man configuration.nix are not present here. (see the NixOS Manual for more details)

How to install

Just add

  terranix = callPackage (super.fetchgit {
    url = "https://github.com/mrVanDalo/terranix.git";
    rev = "2.0.0";
    sha256 = "<sha in here>";
  }) { };

to your NixOS overlays or your shell.nix. Please make sure you use the latest release and use the proper sha.

Documentation

Run man terranix to get an overview on how to use it.

See also