cli icon indicating copy to clipboard operation
cli copied to clipboard

Does When its key is <value> support regex in the value?

Open vrbcntrl opened this issue 4 years ago • 5 comments

** Question : ** <A clear describe of your question. Ex, how can I do [...] for [...] with terraform-compliance ?>

Hi,

I have an use case where I need to check if the value of a key is some thing in the list

Ex: main.tf

{
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"PublicRead",
      "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject","s3:PutObject","s3:PutBucket"],
      "Resource":["arn:aws:s3:::examplebucket/*"]
    }
  ]
}

test.feature

Scenario Outline: test scenario
........
When its Effect is Allow
And its Action is <value>
And it has Principal
Then its value must not match the "^\*$" regex

Examples:
| value     |
| s3:Put.+|

But this scenario is not able to identify the Action parameter values even though I have s3:PutObject and s3:PutBucket

vrbcntrl avatar Jul 01 '20 20:07 vrbcntrl

Hi @vrbcntrl,

Only steps that explicitly mention regular expressions support regex evaluation. So When its Action is <value> does not support regular expressions.

Kudbettin avatar Jul 02 '20 12:07 Kudbettin

Hi @Kudbettin

Thank you for looking into my question.

so, do you think, the support for regex to this particular step would be added in the future?

vrbcntrl avatar Aug 13 '20 18:08 vrbcntrl

I have two work in progress solutions but didn't quite like either of them and ended up pushing this issue under the rug. I think before September is a realistic goal, given I'll be back home by then :)

Kudbettin avatar Aug 13 '20 19:08 Kudbettin

np, thanks for the update.

vrbcntrl avatar Aug 13 '20 20:08 vrbcntrl

Hey, are there any updates to this? I have a scenario where it would be super useful to filter by regex.

alex-w-k avatar Sep 22 '21 19:09 alex-w-k