Skip to content

Terraform fmt in the same job as terraform plan? #150

Answered by dflook
cberge908 asked this question in Q&A
Discussion options

You must be logged in to vote

The dflook/terraform-fmt action will format files in the job workspace, it won't push any changes anywhere.

In the example given here the workflow runs dflook/terraform-fmt followed by peter-evans/create-pull-request to create a pull request to fix any badly formatted changes that have been merged to the default branch.

If you want to format on pull_request and push changes back to the pr branch, you will need to run dflook/terraform-fmt followed by a run step that pushes the changes. There may be action that will do this for you, but it should be as simple as git commit -am "terraform fmt" && git push

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cberge908
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants