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
810 stars 123 forks source link

Tag addition is breaking some existing tags #315

Closed jasonckeating closed 1 year ago

jasonckeating commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

We've enabled Yor autotagging via PrismaCloud, which PR'd changes to many repos adding yor_trace tags.

Every resource that dynamically builds tags with:

tags = merge(var.tags, tomap({ "Name" = format("%s-sample", var.this) }))

yor tagging has broken by turning it into this:

tags = merge(var.tags, tomap({ "Name" = format("%s-sample", var.this) }), {
    Name      = "format(\"%s-sample\""
    git_org   = "this"
    git_repo  = "this-repo"
    yor_trace = "111111111111111111111111111111111111"
  })

To Reproduce Steps to reproduce the behavior:

  1. Create a terraform resource with this as a tag: tags = merge(var.tags, tomap({ "Name" = format("%s-sample", var.this) }))
  2. Yor tag the resource
  3. Observe the broken name with incorrectly placed escapes.

Expected behavior A clear and concise description of what you expected to happen.

Yor needs to handle the map and formatted tag values during handling.

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

Screen Shot 2022-11-16 at 1 13 35 PM

Desktop (please complete the following information):

Additional context Add any other context about the problem here (e.g. code snippets).