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

Error if tags are calculated with a for loop #496

Open
kayman-mk opened this issue Mar 12, 2024 · 1 comment
Open

Error if tags are calculated with a for loop #496

kayman-mk opened this issue Mar 12, 2024 · 1 comment
Labels
wontfix This will not be worked on

Comments

@kayman-mk
Copy link
Contributor

Describe the bug
Yor is not able to deal with statements like { for k, v in local.tags : k => v if k != "environment" } which causes problems in our pipeline. It creates wrong Terraform code:

resource "aws_security_group" "a" {
  name = "b"

  tags = { for k, v in local.tags : k => v if k != "environment"
    yor_name  = "a"
    yor_trace = "c3bec54a-a976-4886-8a03-792318011ed0"
  }
}

To Reproduce

  1. Use the following Terraform file
locals {
  tags = {a: "b", c: "d"}
}

resource "aws_security_group" "a" {
  name = "b"

  tags                  = { for k, v in local.tags : k => v if k != "environment" }
}
  1. Run yor tags -d .
  2. Check the file system. There is still a temporary file which shows incorrect Terraform code.

Expected behavior

  • there should be no temp file left
  • the source code should show the correct tags

Screenshots
none

Desktop (please complete the following information):

  • OS: Linux, Windows
  • Yor Version: 0.1.191

Additional context
None

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