aanderse / teraflops

a terraform ops tool which is sure to be a flop
MIT License
44 stars 2 forks source link

Readme example doesn't build #3

Closed PolarizedIons closed 8 months ago

PolarizedIons commented 8 months ago

Trying out the readme example:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    teraflops.url = "github:aanderse/teraflops";
  };

  outputs = { nixpkgs, teraflops, ... }: {
    teraflops = {
      imports = [ teraflops.modules.hcloud ];

      meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; };

      machine = { pkgs, ... }: {
        deployment.targetEnv = "hcloud";
        deployment.hcloud = {
          server_type = "cx11";
          location = "nbg1";
        };

        environment.systemPackages = [ pkgs.htop ];
      };

      # if desired you can write terraform code directly inside your teraflops modules
      terraform = {
        backend.s3 = {
          bucket = "mybucket";
          key = "path/to/my/key";
          region = "us-east-1";
        };
      };
    };
  };
}

gives me the following error:

  teraflops init    
error:
       … while evaluating attribute 'terraform'

         at /tmp/teraflops.ckrq9vep/bootstrap.nix:40:3:

           39| {
           40|   terraform = (lib.evalModules {
             |   ^
           41|     modules = [ { _module.freeformType = jsonType; } ] ++ (map (i: (i (dummyArgs i)).terraform or { }) imports);

       … while evaluating the attribute 'config'

         at /nix/store/7ay2dd0w41iqvrnkx19v4vf4f5kkxvc2-source/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attempt to call something which is not a function but a set

       at /tmp/teraflops.ckrq9vep/bootstrap.nix:41:69:

           40|   terraform = (lib.evalModules {
           41|     modules = [ { _module.freeformType = jsonType; } ] ++ (map (i: (i (dummyArgs i)).terraform or { }) imports);
             |                                                                     ^
           42|   }).config;
aanderse commented 8 months ago

thanks for trying teraflops

sorry for the error... looks like i made i mistake when adding some new functionality the other day, specifically the set-args command :sweat:

i've gone ahead and pushed the fix in 0c9cee4d4f644aa779baf0fc8d8237df12d3c326 and i hope you'll give it another try

make sure you take a look at the examples to see exactly what software is needed in your environment