You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using nested modules as recommended by Terraform; however, I was running into this error:
hnicholas@hnicholas-a01:~/Repositories/velocloud-terraform-modules$ pre-commit run
Terraform fmt............................................................Passed
Terraform validate.......................................................Failed
- hook id: terraform_validate
- exit code: 1
Error: Failed to read module directory
Module directory ../../../../../modules/security_groups does not exist or
cannot be read.
Failed path: terraform-aws-velocloud-uag/modules/security_groups
================================
Terraform docs...........................................................Passed
Terraform validate with tflint...........................................Passed
Terraform validate with tfsec............................................Passed
I was able to work around the issue by updating .cache/pre-commit/repo<some random string>/terraform_validate.sh:
--- /Users/hnicholas/.cache/pre-commit/repov0zt08cv/terraform_validate.sh.bak 2020-08-28 17:24:34.000000000 -0600+++ /Users/hnicholas/.cache/pre-commit/repov0zt08cv/terraform_validate.sh 2020-08-28 17:05:20.000000000 -0600@@ -97,6 +97,7 @@ terraform_validate_() {
local validate_path
validate_path="${path_uniq#"$terraform_path"}"
+ validate_path="${validate_path#/}"
# Change to the directory that has been initialized, run validation, then
# change back to the starting directory.
I'm sure there's a cleaner way as part of validate_path="${path_uniq#"$terraform_path"}" but I don't have the time to dig deeper tonight... Hopefully this is an easy fix or this helps others.
Thanks!
Version Information
hnicholas@hnicholas-a01:~/Repositories/velocloud-terraform-modules/terraform-aws-velocloud-vce$ terraform --version
Terraform v0.12.29
+ provider.aws v3.4.0
+ provider.time v0.5.0
Your version of Terraform is out of date! The latest version
is 0.13.1. You can update by downloading from https://www.terraform.io/downloads.html
hnicholas@hnicholas-a01:~/Repositories/velocloud-terraform-modules/terraform-aws-velocloud-vce$ pre-commit --version
pre-commit 2.7.1
hnicholas@hnicholas-a01:~/Repositories/velocloud-terraform-modules/terraform-aws-velocloud-vce$ cat ../.pre-commit-config.yaml
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.35.0
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
- id: terraform_tflint
- id: terraform_tfsec
hnicholas@hnicholas-a01:~/Repositories/velocloud-terraform-modules/terraform-aws-velocloud-vce$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.6
BuildVersion: 19G2021
The text was updated successfully, but these errors were encountered:
I am using nested modules as recommended by Terraform; however, I was running into this error:
I was able to work around the issue by updating
.cache/pre-commit/repo<some random string>/terraform_validate.sh
:I'm sure there's a cleaner way as part of
validate_path="${path_uniq#"$terraform_path"}"
but I don't have the time to dig deeper tonight... Hopefully this is an easy fix or this helps others.Thanks!
Version Information
The text was updated successfully, but these errors were encountered: