Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flakelib

usage

inputs.flakelib.url = "";

empty tf state json

{
  "version": 4,
  "terraform_version": "1.9.1",
  "serial": 1,
  "lineage": "00000000-0000-0000-0000-000000000000",
  "outputs": {},
  "resources": [],
  "check_results": []
}

terraform environments

project/
├── cells/
│   └── terraform/
|       ├── env.nix
│       └── env/
|           └── env_name/
|               ├── default.nix
|               ├── __github.nix
|               └── __vultr.nix
└── flake.nix

project/cells/terraform/env.nix

{ cell, inputs, ... }:
inputs.lib.import.profiles {
  src = ./env;
  inputs = {
    inherit (inputs.flakelib.lib.terranix) modules;
    inherit (inputs.flakelib.nixpkgs-lib) lib;
  };
}

project/cells/terraform/env/env_name/default.nix

{ super, ... }:

{ imports = with super; [ github vultr ]; }

project/cells/terraform/env/env_name/__github.nix

{ ... }:

{ lib, ... }:
{
  variable.GITHUB_ORG_TOKEN = {
    type = "string";
    sensitive = true;
  };

  provider.github.token = "\${var.GITHUB_ORG_TOKEN}";
  provider.github.owner = "namespace";

  data.github_repositories.range = {
    query = "repo:namespace/reponame";
    include_repo_id = true;
  };

  resource.github_actions_organization_secret.CACHIX_AUTH_TOKEN = {
    secret_name = "CACHIX_AUTH_TOKEN";
    visibility = "selected";
    plaintext_value = builtins.getEnv "CACHIX_AUTH_TOKEN";
    selected_repository_ids = lib.tf.ref "data.github_repositories.range.repo_ids";
  };
}

project/cells/terraform/env/env_name/__vultr.nix

{ modules, ... }:

{
  imports = [ modules.vultr ];

  vultr.enable = true;
  vultr.dns.domains."exampledomain.name" = [
    {
      type = "MX";
      data = "mx.provider.com";
      priority = 10;
      ttl = 120;
    }
  ];
}

project/flake.nix

{ cellBlocks = [
    (terranix "env" {
      overlays = [ inputs.self.overlays.default ];
      providers = [
        "null"
        "namedotcom"
        "vultr.vultr"
        "integrations.github"
      ];
      repo = "git@github.com:namespace/reponame";
      sops_pgp_fp = [ "Some valid pgp fingerprint" ];
    })
  ] }

blockTypes

terranix

nvsources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors