Skip to content

Commit

Permalink
Allow Terraform fmt for 0.11.14 and 0.12.29 (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxblaze authored Sep 17, 2020
1 parent 61bf1ac commit 3228944
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ RUN wget https://github.com/shyiko/ktlint/releases/download/0.34.2/ktlint \
&& chmod +x ktlint
RUN wget https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64 -O shfmt \
&& chmod +x shfmt
RUN wget https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip -O tf.zip \
RUN wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip -O tf.zip \
&& unzip tf.zip \
&& rm tf.zip \
&& mv terraform terraform0.12
RUN wget https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip -O tf.zip \
&& unzip tf.zip \
&& rm tf.zip

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repo currently contains a single [pre-commit](https://pre-commit.com/) hook
- [ktlint](https://github.com/pinterest/ktlint) v0.34.2 for Kotlin
- [scalafmt](https://scalameta.org/scalafmt/) v2.6.4 for Scala 2.12
- [shfmt](https://github.com/mvdan/sh) v3.0.1 for Shell
- [terraform fmt](https://github.com/hashicorp/terraform) v0.11.7 for Terraform
- [terraform fmt](https://github.com/hashicorp/terraform) v0.11.14 and v0.12.29 for Terraform
- [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) v5.0.1 for Protobuf
- [SVGO](https://github.com/svg/svgo) v1.3.0 for SVG

Expand Down
8 changes: 7 additions & 1 deletion entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,13 @@ const HOOKS: Record<HookName, LockableHook> = {
// parallelizes multiple runs of this hook. This in turn can create a
// race condition that results in a source file getting unintentionally
// deleted!) https://github.com/hashicorp/terraform/pull/20040
sources.map(source => run("/terraform", "fmt", "-write=true", source)),
sources.map(async source => {
try {
await run("/terraform", "fmt", "-write=true", source);
} catch (ex) {
await run("/terraform0.12", "fmt", "-write=true", source);
}
}),
),
include: /\.tf$/,
runAfter: [HookName.WhitespaceFixer],
Expand Down

0 comments on commit 3228944

Please sign in to comment.