git.delta.rocks / jrsonnet / refs/commits / 71200382b2ad

difftreelog

source

modules/extras/tf.nix1.2 KiBsourcehistory
1{2  config,3  lib,4  fleetLib,5  inputs,6  ...7}:8let9  inherit (lib.options) mkOption;10  inherit (lib.types) deferredModule attrsOf unspecified;11  inherit (fleetLib.options) mkDataOption;12in13{1415  options = {16    tf = mkOption {17      type = deferredModule;18      apply =19        module: system:20        inputs.terranix.lib.terranixConfiguration {21          inherit system;22          pkgs = inputs.nixpkgs.legacyPackages.${system};23          modules = [24            module25          ];26        };27    };28  };2930  config = {31    flake.tf = config.tf;3233    tf.output.fleet = {34      value = {35        managed = true;36      };37      # Just to avoid printing this attribute on every apply, the whole fleet attribute38      # will be somehow processed by fleet tf.39      sensitive = true;40    };41    fleetConfigurations.default = {config, ...}: {42      options.data = mkDataOption {43        # host => hostData44        options.extra.terraformHosts = mkOption {45          default = { };46          type = attrsOf (attrsOf unspecified);47          description = "Hosts data provided by fleet tf";48        };49      };50      config.hosts = config.data.extra.terraformHosts;51    };5253    perSystem.imports = [ ./tf-bootstrap.nix ];54  };55}