bridgecrewio / yor

Extensible auto-tagger for your IaC files. The ultimate way to link entities in the cloud back to the codified resource which created it.
https://www.yor.io
Apache License 2.0
827 stars 123 forks source link

fix: Properly detect taggability of remote modules #311

Closed tadeboro closed 1 year ago

tadeboro commented 2 years ago

Changes in this commit make sure that Yor searches in the right folder when determining if module in question is taggable.

For example, before this commit, Yor will skip the policy module:

module "policy" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-policy"
  version = "5.5.4"
  # more here
}

The problem was that Yor was searching for the variables block in the .terraform/modules/policy/*.tf, ignoring the fact that module source tells us that we need to use modules/iam-policy subdirectory.

To remedy the situation, We added a new function that extracts subdirectory from the source and appends it to the search path.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.