From b1358e23a751b7e45fe6a19b294e13bd7eb4323e Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Wed, 29 Sep 2021 13:56:36 +0300 Subject: [PATCH] docs: Improve workaround Relates: #203 --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 11308fda5..2d56ccef4 100644 --- a/README.md +++ b/README.md @@ -314,14 +314,23 @@ Example: - --envs=AWS_SECRET_ACCESS_KEY="asecretkey" ``` -3. It may happen that Terraform working directory (`.terraform`) already exists but not in the best condition (eg, not initialized modules, wrong version of Terraform, etc). To solve this problem you can find and delete all `.terraform` directories in your repository using this command: +3. It may happen that Terraform working directory (`.terraform`) already exists but not in the best condition (eg, not initialized modules, wrong version of Terraform, etc). To solve this problem you can find and delete all `.terraform` directories in your repository: - ```shell - find . -type d -name ".terraform" -print0 | xargs -0 rm -r + ```bash + echo " + function rm_terraform { + find . -name ".terraform*" -print0 | xargs -0 rm -r + } + alias rmtf=rm_terraform + " >>~/.bashrc + + # Reload shell and use `rmtf` command in repo root ``` `terraform_validate` hook will try to reinitialize them before running `terraform validate` command. + **Warning:** If you use Terraform workspaces, DO NOT use this workaround ([details](https://github.com/antonbabenko/pre-commit-terraform/issues/203#issuecomment-918791847)). Wait to [`force-init`](https://github.com/antonbabenko/pre-commit-terraform/issues/224) option implementation + ## Notes for contributors 1. Python hooks are supported now too. All you have to do is: