Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit bd8f895

Browse files
authored
Do not use -recursive option for Terraform 0.11.x (#91)
1 parent a2b6036 commit bd8f895

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.5.1
4+
5+
### Fixed
6+
7+
* Do not use `-recursive` option with `terraform fmt` for Terraform 0.11.x. ([#90](https://github.com/hashicorp/terraform-github-actions/issues/90))
8+
39
## v0.5.0
410

511
### Added
@@ -10,10 +16,6 @@
1016

1117
* Completely refactored the codebase into one GitHub Action. Please refer to the README for current usage.
1218

13-
### Deprecated
14-
15-
N/A
16-
1719
### Removed
1820

1921
* Removed all `TF_ACTION` environment variables. Please refer to the README for current usage.
@@ -25,7 +27,3 @@ N/A
2527
* Added support for Terraform 0.11.14. ([#42](https://github.com/hashicorp/terraform-github-actions/issues/67))
2628
* Comments will not be posted to pull requests when `terraform plan` contains no changes. ([#29](https://github.com/hashicorp/terraform-github-actions/issues/67))
2729
* Added ability to specify a Terraform version to use. ([#23](https://github.com/hashicorp/terraform-github-actions/issues/67))
28-
29-
### Security
30-
31-
N/A

src/main.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ function stripColors {
44
echo "${1}" | sed 's/\x1b\[[0-9;]*m//g'
55
}
66

7+
function hasPrefix {
8+
case ${2} in
9+
"${1}"*)
10+
true
11+
;;
12+
*)
13+
false
14+
;;
15+
esac
16+
}
17+
718
function parseInputs {
819
# Required inputs
920
if [ "${INPUT_TF_ACTIONS_VERSION}" != "" ]; then

src/terraform_fmt.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/bin/bash
22

33
function terraformFmt {
4+
# Eliminate `-recursive` option for Terraform 0.11.x.
5+
fmtRecursive="-recursive"
6+
if hasPrefix "0.11" "${tfVersion}"; then
7+
fmtRecursive=""
8+
fi
9+
410
# Gather the output of `terraform fmt`.
511
echo "fmt: info: checking if Terraform files in ${tfWorkingDir} are correctly formatted"
6-
fmtOutput=$(terraform fmt -check -write=false -diff -recursive 2>&1)
12+
fmtOutput=$(terraform fmt -check -write=false -diff ${fmtRecursive} 2>&1)
713
fmtExitCode=${?}
814

915
# Exit code of 0 indicates success. Print the output and exit.

0 commit comments

Comments
 (0)