-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add Support for Terraform Modules in Terraform Parser #271
Comments
would like to work on this ! |
Hey @hanshal101 Thanks for your interest. Let me know what you need from me to get started. |
yeah sure! |
Just want to make sure, I am on the right path.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
required_version = ">= 1.0"
}
provider "aws" {
region = "us-east-1"
}
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.84.0"
hashes = [
"h1:dwpeFUdcxgXVAc0JSqO57xf0/r2qOBLPloombCQWFz8=",
"zh:078f77438aba6ec8bf9154b7d223e5c71c48d805d6cd3bcf9db0cc1e82668ac3",
"zh:1f6591ff96be00501e71b792ed3a5a14b21ff03afec9a1c4a3fd9300e6e5b674",
"zh:2ab694e022e81dd74485351c5836148a842ed71cf640664c9d871cb517b09602",
"zh:33c8ccb6e3dc496e828a7572dd981366c6271075c1189f249b9b5236361d7eff",
"zh:6f31068ebad1d627e421c72ccdaafe678c53600ca73714e977bf45ff43ae5d17",
"zh:7488623dccfb639347cae66f9001d39cf06b92e8081975235a1ac3a0ac3f44aa",
"zh:7f042b78b9690a8725c95b91a70fc8e264011b836605bcc342ac297b9ea3937d",
"zh:88b56ac6c7209dc0a775b79975a371918f3aed8f015c37d5899f31deff37c61a",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a1979ba840d704af0932f8de5f541cbb4caa9b6bbd25ed552a24e6772175ba07",
"zh:b058c0533dae580e69d1adbc1f69e6a80632374abfc10e8634d06187a108e87b",
"zh:c88610af9cf957f8dcf4382e0c9ca566ef10e3290f5de01d4d90b2d81b078aa8",
"zh:e9562c055a2247d0c287772b55abef468c79f8d66a74780fe1c5e5dae1a284a9",
"zh:f7a7c71d28441d925a25c08c4485c015b2d9f0338bc9707443e91ff8e161d3d9",
"zh:fee533e81976d0900aa6fa443dc54ef171cbd901847f28a6e8edb1d161fa6fde",
]
} So is this what vet does for Thank You. |
@hanshal101 Try running You will see that The https://developer.hashicorp.com/terraform/language/files/dependency-lock If you refer to official docs, you will see:
Hence, you need to actually parse the You can probably write another parser called
|
cool, understood working on it! |
The current terraform parser supports parsing
.terraform.lock.hcl
to extract Terraform Providers. We need to extend it to be able to collect Terraform modules as well.See following for more details:
https://github.com/safedep/vet/blob/main/pkg/parser/terraform.go
Once this support is added,
vet
should be able to identify a Terraform module using its internal package model. Refermodels/models.go
.Handling module is not straight forward because
https://developer.hashicorp.com/terraform/language/files/dependency-lock
So we have a few options:
.terraform/modules/modules.json
which seems to be created byterraform init
if a TF configuration uses modules.tf
files and look for remote modules. We are already parsing HCL, so parsing.tf
for modules should not be a problemExample module definition:
We are interested only in remote modules i.e. those that do not start with
.
or..
Read module about module sources at: https://developer.hashicorp.com/terraform/language/modules/sources
The text was updated successfully, but these errors were encountered: