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

tag-prefix doesn't work with tags or tag-groups cli switches #492

Open
jim-weller opened this issue Mar 8, 2024 · 3 comments
Open

tag-prefix doesn't work with tags or tag-groups cli switches #492

jim-weller opened this issue Mar 8, 2024 · 3 comments
Labels
wontfix This will not be worked on

Comments

@jim-weller
Copy link

Describe the bug
tag-prefix does not play well with other command line switches. I've tried quite a few combinations of switches. Prefix only seems to work in the barest of configurations.

To Reproduce
main.tf

resource "aws_ssm_parameter" "environment_type" {
  name        = "environment_type"
  type        = "String"
  value       = "dev"
  description = "A basic SSM parameter that will vary between DEV and PROD aws accounts according to the tfvars files in the env/ directory."

  # tags will be injected below  here by yor
}

prefix switch breaks behavior when specifying tags

❯ yor tag -d . --tags yor_trace  --tag-prefix "test:" --dry-run
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.189
 Yor Findings Summary
 Scanned Resources:	  1
 New Resources Traced: 	  0
 Updated Resources:	  0

prefix switch works alone

❯ yor tag -d . --tag-prefix "technical:" --dry-run
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.189
 Yor Findings Summary
 Scanned Resources:	  1
 New Resources Traced: 	  1
 Updated Resources:	  0

New Resources Traced (1):
+---------+------------------------------------+--------------------------------+------------------------------------------+--------+
|  FILE   |              RESOURCE              |            TAG KEY             |                TAG VALUE                 | YOR ID |
+---------+------------------------------------+--------------------------------+------------------------------------------+--------+
| main.tf | aws_ssm_parameter.environment_type | technical:yor_trace            | cc810173-70aa-4c76-9493-5edd20288bec     |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:yor_name             | environment_type                         |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_repo             | enbl-demo-iac-yor-tagging                |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_org              | HylandSoftware                           |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_modifiers        | jim.weller                               |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_last_modified_by | jim.weller@hyland.com                    |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_last_modified_at | 2024-02-29 15:21:45                      |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_file             | main.tf                                  |        |
+         +                                    +--------------------------------+------------------------------------------+--------+
|         |                                    | technical:git_commit           | 4c39aa9f59024a8d618a77bba5a75f05345058e5 |        |
+---------+------------------------------------+--------------------------------+------------------------------------------+--------+

Expected behavior
yor should tag files with the appropriate prefix and honor other CLI switches like tags and tag-groups.

Desktop (please complete the following information):

  • OS: MacOS 14.3.1 (Darwin APL-wfh0x9vmc6 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64)
  • Yor Version: yor version 0.1.189

Additional context
n/a

@jim-weller
Copy link
Author

More weird combinations

works, just the tag-group for git

  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.189
 Yor Findings Summary
 Scanned Resources:	  1
 New Resources Traced: 	  1
 Updated Resources:	  0

New Resources Traced (1):
+---------+------------------------------------+---------------------------+------------------------------------------+--------+
|  FILE   |              RESOURCE              |          TAG KEY          |                TAG VALUE                 | YOR ID |
+---------+------------------------------------+---------------------------+------------------------------------------+--------+
| main.tf | aws_ssm_parameter.environment_type | TEST_git_repo             | enbl-demo-iac-yor-tagging                |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_org              | HylandSoftware                           |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_modifiers        | jim.weller                               |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_last_modified_by | jim.weller@hyland.com                    |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_last_modified_at | 2024-02-29 15:21:45                      |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_file             | main.tf                                  |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_commit           | 4c39aa9f59024a8d618a77bba5a75f05345058e5 |        |
+---------+------------------------------------+---------------------------+------------------------------------------+--------+

add code2cloud tag-group and it still works

❯ yor tag -d . --tag-prefix "TEST_" --tag-groups git,code2cloud  --dry-run
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.189
 Yor Findings Summary
 Scanned Resources:	  1
 New Resources Traced: 	  1
 Updated Resources:	  0

New Resources Traced (1):
+---------+------------------------------------+---------------------------+------------------------------------------+--------+
|  FILE   |              RESOURCE              |          TAG KEY          |                TAG VALUE                 | YOR ID |
+---------+------------------------------------+---------------------------+------------------------------------------+--------+
| main.tf | aws_ssm_parameter.environment_type | TEST_yor_trace            | baf4cd53-f627-4f80-9511-bb467ebcc121     |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_yor_name             | environment_type                         |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_repo             | enbl-demo-iac-yor-tagging                |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_org              | HylandSoftware                           |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_modifiers        | jim.weller                               |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_last_modified_by | jim.weller@hyland.com                    |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_last_modified_at | 2024-02-29 15:21:45                      |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_file             | main.tf                                  |        |
+         +                                    +---------------------------+------------------------------------------+--------+
|         |                                    | TEST_git_commit           | 4c39aa9f59024a8d618a77bba5a75f05345058e5 |        |
+---------+------------------------------------+---------------------------+------------------------------------------+--------+

add a tag and it fails

❯ yor tag -d . --tag-prefix "TEST_" --tag-groups git --tags git_repo  --dry-run
  __    __
  \ \  / /
   \ \/ /___  _  ____
    \  /  _ \| |/  __|
    | |  |_| |   /
    |_|\____/|__|v0.1.189
 Yor Findings Summary
 Scanned Resources:	  1
 New Resources Traced: 	  0
 Updated Resources:	  0

@jim-weller
Copy link
Author

It looks like tags and tag-prefix are incompatible. This doesn't work

yor tag -d . --tag-prefix "TEST_" --tags git_repo --dry-run

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

1 participant