config/tf: Migrate from trusted submodule. Deploy fix paths.

This commit is contained in:
kat witch 2021-11-14 20:59:40 +00:00
parent fbf54a06b2
commit bddafe34e3
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
3 changed files with 26 additions and 3 deletions

View file

@ -32,7 +32,7 @@ in
{
imports = [
(toString (sources.tf-nix + "/modules/run.nix"))
] ++ (optional (builtins.pathExists ../../trusted/tf/tf.nix) (../../trusted/tf/tf.nix));
] ++ (optional (builtins.pathExists ../../tf/tf.nix) (../../tf/tf.nix));
options = {
deploy = {
dataDir = mkOption {
@ -83,6 +83,15 @@ in
deps = {
select.allProviders = true;
enable = true;
/*
apply = {
doneCommand = ''
git -C "${cfg.dataDir}" add -A
git -C "${cfg.dataDir}" commit -m "${config.name}: $(date +'%F %T')"
git -C "${cfg.dataDir}" push
'';
};
*/
};
terraform = {
version = "1.0";
@ -101,8 +110,21 @@ in
attrPrefix = "deploy.targets.${name}.tf.runners.run.";
};
run = {
apply.name = "${name}-apply";
apply.name = "${name}-apply-uw";
terraform.name = "${name}-tf";
myApply = {
name = "${name}-apply";
command = let
path = toString cfg.dataDir;
in ''
set -e
git -C "${path}" pull
${config.tf.runners.run.apply.package}/bin/${config.tf.runners.run.apply.executable}
git -C "${path}" add -A
git -C "${path}" commit -m "${config.name}: $(date +'%F %T')"
git -C "${path}" push --force
'';
};
};
};
continue.envVar = "TF_NIX_CONTINUE_${replaceStrings [ "-" ] [ "_" ] config.name}";

1
config/tf Submodule

@ -0,0 +1 @@
Subproject commit c1263b12d719256ffcf2a8fb49a9a821caa229b3

@ -1 +1 @@
Subproject commit b70784634ce12f0c53859767c52e31e6f8e1ead7
Subproject commit 24d46cfc0082e042628f05600ab2d648dd6d4fe6