Skip to content
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

support for terraform registry remote modules #505

Merged
merged 24 commits into from
Jan 22, 2021

Conversation

patilpankaj212
Copy link
Contributor

  1. Added remote module downloader for terraform registry
  2. Fix issue - failure if the remote module itself has local modules

@codecov
Copy link

codecov bot commented Jan 20, 2021

Codecov Report

Merging #505 (4ccc1d0) into master (ddb6f64) will increase coverage by 1.83%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #505      +/-   ##
==========================================
+ Coverage   73.73%   75.57%   +1.83%     
==========================================
  Files          93       94       +1     
  Lines        2151     2227      +76     
==========================================
+ Hits         1586     1683      +97     
+ Misses        429      401      -28     
- Partials      136      143       +7     
Impacted Files Coverage Δ
...viders/terraform/commons/remote-module-download.go 67.85% <67.85%> (ø)
pkg/iac-providers/terraform/commons/load-dir.go 82.85% <84.21%> (+0.16%) ⬆️
...iac-providers/terraform/commons/module-download.go 100.00% <100.00%> (ø)
pkg/policy/opa/engine.go 61.57% <0.00%> (+1.38%) ⬆️
.../iac-providers/terraform/commons/cty-converters.go 86.11% <0.00%> (+5.55%) ⬆️
pkg/iac-providers/terraform/commons/references.go 75.51% <0.00%> (+8.16%) ⬆️
...providers/terraform/commons/variable-references.go 81.66% <0.00%> (+16.66%) ⬆️
...ac-providers/terraform/commons/local-references.go 80.00% <0.00%> (+76.66%) ⬆️

@patilpankaj212 patilpankaj212 linked an issue Jan 22, 2021 that may be closed by this pull request
fix dependencies that were breaking the darwin/arm64 build
go.mod Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Jan 22, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@kanchwala-yusuf kanchwala-yusuf dismissed devang-gaur’s stale review January 22, 2021 17:15

Requested changes are already accommodated

@kanchwala-yusuf kanchwala-yusuf merged commit 51aaf1f into tenable:master Jan 22, 2021
@patilpankaj212 patilpankaj212 deleted the remote-module-support branch January 25, 2021 05:12
@jlunaq
Copy link

jlunaq commented Feb 26, 2021

Hi there,

Are the remote modules only downloadable from the official terraform registry? I need to download some modules from my private repos but it tries to read them locally.

@patilpankaj212
Copy link
Contributor Author

patilpankaj212 commented Feb 27, 2021

Hello @jlunaq,
We support following remote backends - git, s3, gcs, http, terraform-registry
Could you please let us know where you have hosted your repo?
Can you please give an example of the source attribute in your module definition?

@jlunaq
Copy link

jlunaq commented Mar 4, 2021

Hi @patilpankaj212 ,

Sorry for the late response, I haven't been notified.
The repo is in github, I found that terrascan is able to read the module when it is in the root directory.
So this issue is more related to the modules which are in a subdirectory, like this:

source = "[email protected]:company/module.git//modules/base?ref=v2.0.0"

In this case is where I'm getting the error

<nil>: Failed to read module directory; Module directory /Users/jluna/my-project/[email protected]:company/module.git/modules/roles does not exist or cannot be read.

@patilpankaj212
Copy link
Contributor Author

Hello @jlunaq,
Thanks for doing the tests. Looks like a defect to me. Can you please open a issue for this case?

@jlunaq
Copy link

jlunaq commented Mar 9, 2021

Sure, will do

@jlunaq
Copy link

jlunaq commented Mar 9, 2021

#600

@patilpankaj212
Copy link
Contributor Author

Thanks @jlunaq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terrascan consider source = "terraform-aws-modules/vpc/aws" as local path Failed to read module directory
4 participants