All Projects → tweag → Terraform Nixos

tweag / Terraform Nixos

Licence: apache-2.0
A set of Terraform modules that are designed to deploy NixOS

Labels

Projects that are alternatives of or similar to Terraform Nixos

Aws Accounts Terraform
Stars: ✭ 108 (-6.9%)
Mutual labels:  hcl
Nix Config
My NixOS configuration
Stars: ✭ 112 (-3.45%)
Mutual labels:  nixos
Terraform aws scp
AWS Organizations Service Control Policies (SCPs) written in HashiCorp Terraform.
Stars: ✭ 114 (-1.72%)
Mutual labels:  hcl
Terraform Aws Config
Enables AWS Config and adds managed config rules with good defaults.
Stars: ✭ 107 (-7.76%)
Mutual labels:  hcl
Nix Deploy
Deploy software or an entire NixOS system configuration to another NixOS system
Stars: ✭ 111 (-4.31%)
Mutual labels:  nixos
Aws Lambda Es Cleanup
AWS Elasticsearch Lambda Curator
Stars: ✭ 112 (-3.45%)
Mutual labels:  hcl
Libvirt K8s Provisioner
Automate your k8s installation
Stars: ✭ 106 (-8.62%)
Mutual labels:  hcl
Hello Lambda
🔥 An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.
Stars: ✭ 114 (-1.72%)
Mutual labels:  hcl
Terraform Config
Terraform bits and bytes
Stars: ✭ 111 (-4.31%)
Mutual labels:  hcl
Best Practices
No description, website, or topics provided.
Stars: ✭ 1,478 (+1174.14%)
Mutual labels:  hcl
Terraform Google Vault
A Terraform Module for how to run Vault on Google Cloud using Terraform and Packer
Stars: ✭ 108 (-6.9%)
Mutual labels:  hcl
Terraform Aws Ecr
Terraform Module to manage Docker Container Registries on AWS ECR
Stars: ✭ 110 (-5.17%)
Mutual labels:  hcl
Awesome Codepipeline Ci
an AWS CodePipeline, AWS CodeBuild, AWS APIGateway & AWS Lambda CI
Stars: ✭ 112 (-3.45%)
Mutual labels:  hcl
Aws Ecs Airflow
Run Airflow in AWS ECS(Elastic Container Service) using Fargate tasks
Stars: ✭ 107 (-7.76%)
Mutual labels:  hcl
Docker
Dockerfiles to package Nix in a minimal docker container
Stars: ✭ 114 (-1.72%)
Mutual labels:  nixos
Solutions Terraform Cloudbuild Gitops
Stars: ✭ 106 (-8.62%)
Mutual labels:  hcl
Terraform Up And Running Code
Code samples for the book "Terraform: Up & Running" by Yevgeniy Brikman
Stars: ✭ 1,739 (+1399.14%)
Mutual labels:  hcl
Kubernetes Coreos Terraform
Simple Kubernetes cluster on CoreOS in AWS using Terraform
Stars: ✭ 114 (-1.72%)
Mutual labels:  hcl
Terraform Null Ansible
Terraform Module to run ansible playbooks
Stars: ✭ 114 (-1.72%)
Mutual labels:  hcl
Iohk Ops
NixOps deployment configuration for IOHK devops
Stars: ✭ 113 (-2.59%)
Mutual labels:  nixos

Terraform and Nix integration

built with nix

This repository contains a set of Terraform Modules designed to deploy NixOS machines. These modules are designed to work together and support different deployment scenarios.

What is Terraform?

Terraform is a tool that allows to declare infrastructures as code.

What is Nix, nixpkgs and NixOS?

Nix is a build system and package manager that allows to manage whole system configurations as code. nixpkgs is a set of 20k+ packages built with Nix. NixOS is a Linux distribution built on top of nixpkgs.

What is a Terraform Module?

A Terraform Module refers to a self-contained package of Terraform configurations that are managed as a group. This repo contains a collection of Terraform Modules which can be composed together to create useful infrastructure patterns.

Terraform + Nix vs NixOps

NixOps is a great tool for personal deployments. It handles a lot of things like cloud resource creation, machine NixOS bootstrapping and deployment.

The difficulty is when the cloud resources are not supported by NixOps. It takes a lot of work to map all the cloud APIs. Compared to NixOps, Terraform has become an industry standard and has thousands of people contributing new cloud API mapping all the time.

Another issue is when sharing the configuration as code with multiple developers. Both NixOps and Terraform maintain a state file of "known applied" configuration. Unlike NixOps, Terraform provides facilities to sync and lock the state file so it's available by other users.

The approach here is to use Terraform to create all the cloud resources. By using the google_image_nixos_custom module it's possible to pre-build images in auto-scaling scenarios. Or use a push model similar to NixOps with the generic deploy_nixos module.

So overall Terraform + Nix is more flexible and scales better. But it's also more cumbersome to use as it requires to learn two languages instead of one and the integration between both is also a bit clunky.

Terraform Modules

The list of modules provided by this project:

Using these modules from your terraform configuration

Terraform supports importing modules directly from a GitHub repository.

For example, to use the deploy_nixos module:

module "deploy_nixos" {
  source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=ced68729b6a0382dda02401c8f663c9b29c29368"

  … module-specific fields …
}

Beware the double //, which separates the github repository url from the subdirectory that contains the module. ?ref= specifies a specific git ref of the repository, in this case the commit ced687….

Examples

To better understand how these modules can be used together, look into the ./examples folder.

Related projects

Future

  • Support other cloud providers.
  • Support nixos-infect bootstrapping method.

Contributions are welcome!

Thanks

Thanks to Digital Asset for generously sponsoring this work!

Thanks to Tweag for enabling this work and the continuous support!

License

This code is released under the Apache 2.0 License. Please see LICENSE for more details.

Copyright © 2018 Tweag I/O.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].