diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index b0f09ab..0c3cf66 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -39,12 +39,20 @@ jobs: - name: Terraform Format id: fmt run: | - terraform fmt -check + terraform fmt + if ! git diff-index --quiet HEAD; then + git config --global user.name '${{ vars.REPO_OWNER }}' + git config --global user.email '${{ vars.REPO_OWNER_EMAIL }}' + git commit -am "Autoformatting TF Code" + git push + echo "auto_format=true" >> $GITHUB_ENV + fi - name: Autoformat Halt if: env.auto_format == 'true' run: exit 1 + - name: Terraform Init id: init run: terraform init -upgrade