New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tf-dependency-analyzer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tf-dependency-analyzer - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "tf-dependency-analyzer",
"version": "0.1.1",
"version": "0.1.2",
"description": "Analyze a terraform directory and get a list of terraform/providers/and modules.",

@@ -5,0 +5,0 @@ "main": "dist/cli/index.js",

@@ -65,8 +65,8 @@ # TF Dependency Analyzer

- An array of `Module` instances.
- `updateTerraform`
- A boolean indicating whether to update Terraform instances.
- `updateProviders`
- A boolean indicating whether to update provider instances.
- `updateModules`
- A boolean indicating whether to update module instances.
- `analyzeTerraform`
- A boolean indicating whether to analyze Terraform instances.
- `analyzeProviders`
- A boolean indicating whether to analyze provider instances.
- `analyzeModules`
- A boolean indicating whether to analyze module instances.
- `providerVersionMap`

@@ -73,0 +73,0 @@ - A `Map` object containing provider names and their corresponding URLs.

@@ -31,29 +31,40 @@ import { FileHandler } from '../fileHandler';

}
if (!parsedArgs.has('updateTerraform')) {
console.log('No updateTerraform argument provided.');
if (!parsedArgs.has('analyzeTerraform')) {
console.log('No analyzeTerraform argument provided.');
return;
}
if (!parsedArgs.has('updateProviders')) {
console.log('No updateProviders argument provided.');
if (!parsedArgs.has('analyzeProviders')) {
console.log('No analyzeProviders argument provided.');
return;
}
if (!parsedArgs.has('updateModules')) {
console.log('No updateModules argument provided.');
if (!parsedArgs.has('analyzeModules')) {
console.log('No analyzeModules argument provided.');
return;
}
if (!parsedArgs.has('githubPAT')) {
if (!(process.env.TDU_GITHUB_PAT as string)) {
console.log('No githubPAT argument provided and TDU_GITHUB_PAT is not set.');
return;
}
}
if (!parsedArgs.has('githubEnterprisePAT')) {
if (!(process.env.TDU_GITHUB_ENTERPRISE_PAT as string)) {
console.log('No githubEnterprisePAT argument provided and TDU_GITHUB_ENTERPRISE_PAT is not set.');
return;
}
}
const tfDir = parsedArgs.get('dir') as string;
const updateTerraform = parsedArgs.get('updateTerraform') === 'true';
const updateProviders = parsedArgs.get('updateProviders') === 'true';
const updateModules = parsedArgs.get('updateModules') === 'true';
const analyzeTerraform = parsedArgs.get('analyzeTerraform') === 'true';
const analyzeProviders = parsedArgs.get('analyzeProviders') === 'true';
const analyzeModules = parsedArgs.get('analyzeModules') === 'true';
const gitHubPAT = parsedArgs.get('githubPAT') as string ?? process.env.TDU_GITHUB_PAT as string;
const gitHubEnterprisePAT = parsedArgs.get('githubEnterprisePAT') as string ?? process.env.TDU_GITHUB_ENTERPRISE_PAT as string;
console.log("Config:")
console.log("\nConfig:")
console.log(` TF Directory: ${tfDir}`);
console.log(` Update Terraform: ${updateTerraform}`);
console.log(` Update Providers: ${updateProviders}`);
console.log(` Update Modules: ${updateModules}`);
console.log(` Analyze Terraform: ${analyzeTerraform}`);
console.log(` Analyze Providers: ${analyzeProviders}`);
console.log(` Analyze Modules: ${analyzeModules}\n`);
const gitHubPAT = process.env.TDU_GITHUB_PAT as string;
const gitHubEnterprisePAT = process.env.TDU_GITHUB_ENTERPRISE_PAT as string;
const files = await findTerraformFiles(tfDir);

@@ -64,3 +75,3 @@

for (const file of files) {
const fileHandler = new FileHandler(file, gitHubPAT, gitHubEnterprisePAT, updateTerraform, updateProviders, updateModules, undefined);
const fileHandler = new FileHandler(file, gitHubPAT, gitHubEnterprisePAT, analyzeTerraform, analyzeProviders, analyzeModules, undefined);
await fileHandler.populate();

@@ -67,0 +78,0 @@

@@ -12,5 +12,5 @@ import fs from 'fs'

moduleInstances: Module[]
updateTerraform: boolean
updateProviders: boolean
updateModules: boolean
analyzeTerraform: boolean
analyzeProviders: boolean
analyzeModules: boolean
providerVersionMap: Map<string, string>

@@ -25,5 +25,5 @@

* @param file The path to the Terraform source file.
* @param updateTerraform Whether to update Terraform instances.
* @param updateProviders Whether to update provider instances.
* @param updateModules Whether to update module instances.
* @param analyzeTerraform Whether to analyze Terraform instances.
* @param analyzeProviders Whether to analyze provider instances.
* @param analyzeModules Whether to analyze module instances.
*/

@@ -34,5 +34,5 @@ constructor(

gitHubEnterprisePAT: string | undefined,
updateTerraform: boolean,
updateProviders: boolean,
updateModules: boolean,
analyzeTerraform: boolean,
analyzeProviders: boolean,
analyzeModules: boolean,
providerVersionMap: Map<string, string> | undefined

@@ -43,5 +43,5 @@ ) {

this.gitHubEnterprisePAT = gitHubEnterprisePAT ?? ''
this.updateTerraform = updateTerraform
this.updateProviders = updateProviders
this.updateModules = updateModules
this.analyzeTerraform = analyzeTerraform
this.analyzeProviders = analyzeProviders
this.analyzeModules = analyzeModules
this.providerVersionMap = providerVersionMap ?? new Map<string, string>()

@@ -64,5 +64,5 @@ this.fileContents = this.getFileContents()

async populate() {
if (this.updateTerraform) await this.getTerraformInstances()
if (this.updateProviders) await this.getProviderInstances()
if (this.updateModules) await this.getModuleInstances()
if (this.analyzeTerraform) await this.getTerraformInstances()
if (this.analyzeProviders) await this.getProviderInstances()
if (this.analyzeModules) await this.getModuleInstances()
}

@@ -69,0 +69,0 @@

@@ -117,3 +117,3 @@ import path from 'path'

headers: {
'User-Agent': 'update-terraform-action'
'User-Agent': 'tf-dependency-analyzer'
}

@@ -214,3 +214,3 @@ }

headers: {
'User-Agent': 'update-terraform-action',
'User-Agent': 'tf-dependency-analyzer',
Authorization: authHeader

@@ -222,3 +222,3 @@ }

headers: {
'User-Agent': 'update-terraform-action'
'User-Agent': 'tf-dependency-analyzer'
}

@@ -275,3 +275,3 @@ }

headers: {
'User-Agent': 'update-terraform-action',
'User-Agent': 'tf-dependency-analyzer',
Authorization: `Bearer ${gitHubPAT}`

@@ -278,0 +278,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc