workflows
section in digger.yml. Handy for integration with other CLIs like infracost.
Environment variables
Digger makes the following environment variables available to custom commands:$DEFAULT_BRANCH
$DIGGER_OUT
$PR_BRANCH
$PROJECT_NAME
$DIGGER_PLANFILE
(the path where terraform plan file should be written)
$DIGGER_OUT
If your custom command writes into a file path defined in the$DIGGER_OUT
env variable, then its content will be appended to the comment as “additional output”:

$DIGGER_OUT
defaults to $RUNNER_TEMP/digger-out.log
; you can change that if needed by setting the env var explicitly.
Overriding plan commands
You can add extra arguments to the plan command by setting theextra_args
key in the steps
section of the plan
command.
However in some cases if you wish to override the plan command entirely you can do it by excluding the plan in the steps and having your command specified in the run like so:
$DIGGER_PLANFILE
env variable, since this will be used in postprocessing steps by digger.
Similarly for the apply step you can use the $DIGGER_PLANFILE
env variable to point to the plan file to apply. Note that this will only work when you have the plan persistence
configured. If plan persistence is not configured, the $DIGGER_PLANFILE
environment variable will not be set during the apply step. Here is an example with both plan and apply commands overriden: