aanderse / teraflops

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

expose machine name / resource? #18

Closed KiaraGrouwstra closed 1 month ago

KiaraGrouwstra commented 1 month ago

in order to get my nixos configurations right, i would like to be able to use some networking info, which fortunately teraflops exposes thru resources.

one such relevant bit for example appears exposed at resources.hcloud_server."${name}".ipv6_network. unfortunately tho, i'm not actually sure how to access this still, notably missing access to such a name attribute by default.

(or, conversely, if the server's own resource were exposed directly instead, one would not need the name needed to pull it from resources.)

as a workaround i'm trying to automatically pass this info for all servers using lib.mapAttrs, tho i hadn't managed that yet, while perhaps this info would be useful enough that having a documented way to access this would be cool.

KiaraGrouwstra commented 1 month ago

workaround seems:

# teraflops.nix
{
...
}
//
  lib.mapAttrs
  (name: fn: fn name)
  {
    my_server = name: {pkgs, ...}: import ./server/config.nix {inherit pkgs name;};
  }