-
Notifications
You must be signed in to change notification settings - Fork 518
Adds support for using Terraform modules cached locally #940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for using Terraform modules cached locally #940
Conversation
Codecov Report
@@ Coverage Diff @@
## master #940 +/- ##
==========================================
- Coverage 79.10% 78.93% -0.17%
==========================================
Files 220 221 +1
Lines 5359 5413 +54
==========================================
+ Hits 4239 4273 +34
- Misses 866 880 +14
- Partials 254 260 +6
|
ec41505
to
6e79069
Compare
Fixes typo
- changed interface method signature to accept map parameter so that we can pass any no of flag to implementer without changing method signature. - moved the non recursive flag to map to achieve uniformity - In terraform used switch for flag identification so that in future new flag or option provided just need to add another case rather than if/else
updated all links .
We doSupport TLS certificate/key in existing secrets
Adds pre-commit integration for Terrascan Co-authored-by: mihirhasan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to test this feature, but seems like it's not deducting the module directory correctly. I'm using Terraform v0.15.5 with this main.tf file:
module "vault" {
source = "hashicorp/vault/aws"
version = "0.16.0"
ssh_key_name = ""
create_dns_entry = false
}
When I run:
terrascan scan -i terraform --use-terraform-cache -l debug
I get this error message and it also downloads the modules instead of using the local cache
2021-08-01T22:52:56.103-0400 error utils/dir.go:49 directory /Users/myusername/programming/vault/.terraform/modules/vault/.terraform/modules does not exist.
2021-08-01T22:52:56.103-0400 debug downloader/getter.go:49 downloading "github.com/hashicorp/terraform-aws-consul.git?ref=v0.8.0" to "/var/folders/2g/9lkfm6ld2lv350svwr15fdgc0000gn/T/n1ukaa"
The cached modules are actually located at:
/Users/myusername/programming/vault/.terraform/modules
- modified code to make scan directory non recursively when --use-terraform-cache is used. - modified scan command flag description and docs accordingly.
- modified docker LoadIacDir and LoadIacFile method to accept map parameter - registered docker as cloud provider so that docker policies will be used from '.terrascan' folder
Kudos, SonarCloud Quality Gate passed!
|
Add: support for using the terraform init cache for remote modules rather than downloading it again. It will try to use the remote module from terraform cache if --use-terraform-cache flag is set and if the module is not found in cache it will be downloaded
Usage
Closes #936