diff --git a/CHANGELOG.md b/CHANGELOG.md index cc5bca18..ea4109ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.4.0 + +- Bump to Terraform v0.15.0 internally (only affects `fmt`) +- Change the way `plan`s are truncated after introduction of new horizontal break in TF v0.15.0 +- Add `validate` comment handling +- Update readme + ## v1.3.0 - Bump to Terraform v0.14.9 internally (only affects `fmt`) diff --git a/README.md b/README.md index 59bf9295..a51a1b4b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ Adds opinionated comments to PR's based on Terraform `fmt`, `init`, `plan` and ` ## Summary -This Docker-based GitHub Action is designed to work in tandem with [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) with the wrapper enabled, taking the output from a `fmt`, `init`, `plan` or `validate`, formatting it and adding it to a pull request. Any previous comments from this Action are removed to keep the PR timeline clean. +This Docker-based GitHub Action is designed to work in tandem with [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) with the **wrapper enabled**, taking the output from a `fmt`, `init`, `plan` or `validate`, formatting it and adding it to a pull request. Any previous comments from this Action are removed to keep the PR timeline clean. + +> The `terraform_wrapper` needs to be set to `true` (which is already the default) for the `hashicorp/setup-terraform` step as it enables the capturing of `stdout`, `stderr` and the `exitcode`. Support (for now) is [limited to Linux](https://help.github.com/en/actions/creating-actions/about-actions#types-of-actions) as Docker-based GitHub Actions can only be used on Linux runners. @@ -92,7 +94,7 @@ jobs: uses: hashicorp/setup-terraform@v1 with: cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} - terraform_version: 0.14.5 + terraform_version: 0.15.0 - name: Terraform Format id: fmt @@ -172,7 +174,7 @@ jobs: uses: hashicorp/setup-terraform@v1 with: cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} - terraform_version: 0.14.5 + terraform_version: 0.15.0 - name: Terraform Init - ${{ matrix['workspace'] }} id: init @@ -202,22 +204,30 @@ jobs: "What's the crazy-looking `if:` doing there?" Good question! It's broken into 3 logic groups separated by `&&`, so all need to return `true` for the step to run: -1. `always()` - ensures that the step is run regardless of the outcome in any previous steps -2. `github.ref != 'refs/heads/master'` - prevents the step running on a `master` branch -3. `(steps.step_id.outcome == 'success' || steps.step_id.outcome == 'failure')` - limits the run to the specific `step_id` only when there's a `success` or `failed` outcome. +1. `always()` - ensures that the step is run regardless of the outcome in any previous steps. i.e. We don't want the build to quit after the previous step before we can write a PR comment with the failure reason. +2. `github.ref != 'refs/heads/master'` - prevents the step running on a `master` branch. PR comments are not possible when there's no PR! +3. `(steps.step_id.outcome == 'success' || steps.step_id.outcome == 'failure')` - ensures that this step only runs when `step_id` has either a `success` or `failed` outcome. -In English: "Always run this step, but only on a pull request and only when the previous step succeeds or fails." +In English: "Always run this step, but only on a pull request and only when the previous step succeeds or fails...and then stop the build." ## Screenshots -### fmt +### `fmt` ![fmt](images/fmt-output.png) -### plan +### `init` + +![fmt](images/init-output.png) + +### `plan` ![fmt](images/plan-output.png) +### `validate` + +![fmt](images/validate-output.png) + ## Troubleshooting & Contributing Feel free to head over to the [Issues](https://github.com/robburger/terraform-pr-commenter/issues) tab to see if the issue you're having has already been reported. If not, [open a new one](https://github.com/robburger/terraform-pr-commenter/issues/new) and be sure to include as much relevant information as possible, including code-samples, and a description of what you expect to be happening. diff --git a/images/fmt-output.png b/images/fmt-output.png index bf3bb8a1..e56c1bb0 100644 Binary files a/images/fmt-output.png and b/images/fmt-output.png differ diff --git a/images/init-output.png b/images/init-output.png new file mode 100644 index 00000000..8abf9859 Binary files /dev/null and b/images/init-output.png differ diff --git a/images/plan-output.png b/images/plan-output.png index 3061ea2f..4de01d5b 100644 Binary files a/images/plan-output.png and b/images/plan-output.png differ diff --git a/images/validate-output.png b/images/validate-output.png new file mode 100644 index 00000000..082ab0bb Binary files /dev/null and b/images/validate-output.png differ