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

fix(misconf): load full Terraform module #7925

Merged
merged 3 commits into from
Nov 25, 2024
Merged

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented Nov 15, 2024

Description

Script for preparing repositories:

#!/usr/bin/env bash

readonly num_repos=100
readonly repos=$(
    gh repo list "cloudposse" -L $num_repos --json nameWithOwner,name | \
        jq '[ .[] | select(.name | startswith("terraform-aws")) ]'
)

mkdir -p aws

while read repo
do
  name=$(echo "$repo" | jq -r .name)
  nameWithOwner=$(echo "$repo" | jq -r .nameWithOwner)

  target=aws/$name
  if [ -d $target ]; then
    echo $name already exists
    continue
  fi
  mkdir -p $target
  git clone https://github.com/$nameWithOwner $target
done < <(echo "$repos" | jq -c '.[]')

First run to create the cache:

❯ rm -rf $TMPDIR/.aqua/cache
❯ ./trivy conf . -d --timeout 1h > log.txt 2>&1
❯ cat log.txt | grep "Module resolved from cache" | wc -l
    5595
❯ cat log.txt |grep "Downloading module" |wc -l
     328

Re-run using the cache:

❯ ./trivy conf . -d --timeout 1h > log2.txt 2>&1

❯ cat log2.txt | grep "Module resolved from cache" | wc -l
    5921

❯ cat log2.txt |grep "Downloading module"
2024-11-25T13:23:59+06:00       DEBUG   [module resolver] Downloading module    source="git::https://github.com/ACME/infrastructure.git?ref=0.1.0"
2024-11-25T13:24:02+06:00       DEBUG   [module resolver] Downloading module    source="git::https://github.com/ACME/infrastructure.git?ref=0.1.0"

The module could not be downloaded from https://github.com/ACME/infrastructure.git because the repository no longer exists.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin marked this pull request as ready for review November 25, 2024 09:53
@nikpivkin nikpivkin requested a review from simar7 as a code owner November 25, 2024 09:53
@simar7 simar7 added this pull request to the merge queue Nov 25, 2024
Merged via the queue into aquasecurity:main with commit fbc42a0 Nov 25, 2024
17 checks passed
@nikpivkin nikpivkin deleted the tf-module branch November 26, 2024 04:14
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.

fix(misconf): load full Terraform module
2 participants