Name: terraform-provider-nixos
Owner: Tweag I/O
Description: Terraform provider for NixOS and NixOps
Created: 2018-02-05 20:30:04.0
Updated: 2018-05-22 15:58:39.0
Pushed: 2018-03-17 16:17:24.0
Homepage: null
Size: 1682
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
NixOps has too many responsibilities and not a big enough community. The goal is to reduce NixOps' realm of control by moving all provisioning steps in to Terraform. This combines NixOp's deep support for NixOS with Terraform's nearly universal support for hardware and software providers.
This provider plugin is an experiment.
Clone repository to: $GOPATH/src/github.com/tweag/terraform-provider-nixos
dir -p $GOPATH/src/github.com/tweag; cd $GOPATH/src/github.com/tweag
t clone git@github.com:tweag/terraform-provider-nixos
Enter the provider directory and build the provider
$GOPATH/src/github.com/tweag/terraform-provider-nixos
ke build
ider "nixos" {
ot = "./nixos-machines/"
urce "nixos_node" "my-server" {
de_name = "my-server-name"
= "10.5.3.1"
x = <<NIX
environment.systemPackages = with pkgs; [
file
];
X
This will create a file at ./nixos-machines/my-server.nix
containing:
rraform.ip = "10.5.3.1";
rraform.name = "my-server-name";
vironment.systemPackages = with pkgs; [
file
In your Nix configuration, add a file called terraform.nix
containing:
nfig, lib, pkgs, ... }:
herit (lib) mkIf mkOption types;
g = config.terraform;
tions = {
terraform = {
name = mkOption {
type = types.string;
};
ip = mkOption {
type = types.string;
};
};
and add it to the configuration.nix
via:
ports = [ ./terraform.nix ];
If you're using the provider with NixOps, you may want to add this to
your configuration.nix
:
ployment.targetHost = terraform.ip;
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.8+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
ke bin
OPATH/bin/terraform-provider-tweag
In order to test the provider, you can simply run make test
.
ke test
In order to run the full suite of Acceptance tests, run make testacc
.
Note: Acceptance tests create real resources, and often cost money to run.
ke testacc
Copyright (c) 2018 EURL Tweag.
All rights reserved.
terraform-provider-nixos is free software, and may be redistributed under the terms specified in the LICENSE file.
terraform-provider-nixos is maintained by Tweag I/O.
Have questions? Need help? Tweet at @tweagio.