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

Only "yor" tag group added when "tags" value is specified for a resource #475

Open
rstml opened this issue Feb 12, 2024 · 2 comments
Open
Labels
wontfix This will not be worked on

Comments

@rstml
Copy link

rstml commented Feb 12, 2024

Describe the bug

If tags field of a resource has a value that has been specified using a map {} or merge function, then yor adds only yor_* tag group but not git_*.

To Reproduce
Steps to reproduce the behaviour:

Here's example.tf:

resource "aws_athena_workgroup" "analytics" {
  name = "analytics"

  # no tags

  configuration {
    enforce_workgroup_configuration = true
  }
}

resource "aws_athena_workgroup" "processing" {
  name = "processing"

  tags = merge(module.mylabel.tags, {
    Group = "DataEngineering"
  })

  configuration {
    enforce_workgroup_configuration = false
  }
}

Result

% yor tag -d . -skip-tags yor_name --dry-run
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.188
 Yor Findings Summary
 Scanned Resources:       5
 New Resources Traced:    2
 Updated Resources:       0

New Resources Traced (2):
+----------------------------+------------------------------------+----------------------+------------------------------------------+--------------------------------------+
|            FILE            |              RESOURCE              |       TAG KEY        |                TAG VALUE                 |                YOR ID                |
+----------------------------+------------------------------------+----------------------+------------------------------------------+--------------------------------------+
| example.tf                 | aws_athena_workgroup.analytics     | yor_trace            | 71fa19ce-e2d0-4a39-b178-dcf7f056dd0a     | 71fa19ce-e2d0-4a39-b178-dcf7f056dd0a |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_repo             | aws-data-example                         |                                      |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_org              | rstml                                    |                                      |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_modifiers        | rstml                                    |                                      |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_last_modified_at | 2024-01-31 18:30:02                      |                                      |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_file             | example.tf                               |                                      |
+                            +                                    +----------------------+------------------------------------------+                                      +
|                            |                                    | git_commit           | 139c180d9955xxxxxxxxxxxxxxxxxx973b702472 |                                      |
+                            +------------------------------------+----------------------+------------------------------------------+--------------------------------------+
|                            | aws_athena_workgroup.processing    | yor_trace            | 96d7b44d-7fc0-4171-a1f7-61a49fc7b5cc     | 96d7b44d-7fc0-4171-a1f7-61a49fc7b5cc |
+----------------------------+------------------------------------+----------------------+------------------------------------------+--------------------------------------+
...

Expected behavior
aws_athena_workgroup.processing resource should get git_* tags, similarly how it has got yor_* tags.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Yor Version v0.1.188

Additional context

The behaviour doesn't change even if I specify tags without merge function, i.e. this will still exclude git_* tags:

resource "aws_athena_workgroup" "processing" {
  name = "processing"

  tags = {
    Group = "DataEngineering"
  }

  configuration {
    enforce_workgroup_configuration = false
  }
}
@jim-weller
Copy link

Ha! I just came to report this! Couple edge cases to add.

  • 👍 tags{} statement is not present -> git_* tags are injected
  • 👍 tags{} statement is present without empty lines -> git_* tags are injected
  • 👎 tags{} statement is present with an empty line -> git_* tags are NOT injected
  • 👎 tags{} statement is present with a manually entered tag -> git_* tags are NOT injected

works

# tags from yor go here

works

  # tags from yor go here
  tags = {
  }

NOT work

  # tags from yor go here
  tags = {

  }

NOT work

  # tags from yor go here
  tags = {
    SomeTag = "SomeValue"
  }

Copy link

stale bot commented Apr 23, 2024

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.

@stale stale bot added the wontfix This will not be worked on label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants