terraform-github-actions icon indicating copy to clipboard operation
terraform-github-actions copied to clipboard

Add input for custom flags

Open erzz opened this issue 1 month ago • 2 comments

Suggestion

There is often the need for a custom flag or flags to be added. The one I run into frequently is busy branches where we might need to wait for the lock file to be released and would want to add -lock-timeout=5m

That specific flag could be an input of course, but perhaps it makes sense (and less maintenance for you) if just a additional-flags input was exposed?

erzz avatar Nov 20 '25 14:11 erzz

Every command that locks the state is executed with -lock-timeout=300s. Have you run into any situations where this isn't working, or the job still fails because the state is locked?

If it really is locked for more than 5m it might be better to control the concurrency of the workflow or job.

It would be better to invoke terraform/tofu directly if you need custom behaviour, but there is the TF_CLI_ARGS environment variable.

dflook avatar Nov 20 '25 15:11 dflook

Wow you are fast :)

In my experience its most likely to occur in a busy branch like main combined with something like renovate which can be creating numerous concurrent PRs (thus multiple concurrent plan operations for the same workspace). In this case it can be of course controlled via workflow concurrency.

There are other flags I need sometimes too - though you are absolutely right to suggest TF_CLI_ARGS, thats a great idea (I forget the ENV VARS exist sometimes due to now being so reliant on your actions!)

So we could clear this all up with TF_CLI_ARGS assuming they take precedence over anything set in the action?

erzz avatar Nov 20 '25 16:11 erzz