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
791 stars 120 forks source link

skip-resource-types flag has no effect on resources that do not have a tags attribute name #505

Closed jenswegar closed 1 week ago

jenswegar commented 2 months ago

Describe the bug When tagging terraform files that contain e.g. helm_release or kubernetes_namespace, I get

[WARNING] failed to parse terraform block because failed to find tags attribute name for resource type helm_release

So I tried skipping those blocks by providing a --skip-resource-types helm_release to the command. But it does not seem to have any effect.

To Reproduce Steps to reproduce the behavior:

  1. Create a terraform file containing a helm_release or kubernetes_namespace resource block
  2. Run cli command 'yor tag -d . --skip-resource-types helm_release'
  3. See error

Expected behavior I expect there to be no warning and the scan to go through.

Screenshots

yor tag -d . --skip-resource-types helm_release
2024/04/12 15:01:02 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type helm_release
2024/04/12 15:01:02 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubernetes_namespace
2024/04/12 15:01:02 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type helm_release
2024/04/12 15:01:02 [WARNING] failed to parse terraform block because failed to find tags attribute name for resource type kubectl_manifest
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.191
 Yor Findings Summary
 Scanned Resources:   22
 New Resources Traced:    0
 Updated Resources:   0

Desktop (please complete the following information):

ChanochShayner commented 2 months ago

Hey @jenswegar :) This warning message is just a warning and does not affect the file tagging. The reason that skip-resource-types is not working here is - the warning is in the praseFile flow before we start to tag the resources and look at the skip-resource-types list.

stale[bot] commented 1 month 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.