Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
oneingan committed Jul 30, 2024
1 parent 63de519 commit 2b38372
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/std/fwlib/blockTypes/terra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,21 @@ in

wrap = cmd:
setup
+ (
(pkgs.lib.optionalString (cmd == "plan")) (
postDiffToGitHubSnippet cmd ''
terraform-backend-git git \
--dir "$dir" \
--repository ${git.repo} \
--ref ${git.ref} \
--state ${git.state} \
terraform plan \
-lock=false \
-no-color
''
)
)
+ ''
terraform-backend-git git \
--dir "$dir" \
--repository ${git.repo} \
--ref ${git.ref} \
--state ${git.state} \
terraform ${cmd} "$@";
'';
terraform ${cmd} ${pkgs.lib.optionalString (cmd == "plan") "-out=$dir/plan"} "$@";
''
+ (
(pkgs.lib.optionalString (cmd == "plan")) (
postDiffToGitHubSnippet cmd ''
terraform show --no-color $dir/plan
''
)
);
in [
(mkCommand currentSystem "init" "tf init" [pkgs.jq pkgs.terraform pkgs.terraform-backend-git] (wrap "init") {})
(mkCommand currentSystem "plan" "tf plan" [pkgs.jq pkgs.terraform pkgs.terraform-backend-git] (wrap "plan") {})
Expand Down

0 comments on commit 2b38372

Please sign in to comment.