Open Yakuza-UA opened 11 months ago
Just to let you know that for now I've tackled this scenario by changing my WHEN to look for id
property which ONLY exists in deployed resources and only at the top level:
@case-sensitive
Scenario Outline: Ensure resource names follow naming convention
Given I have <resource_type> defined
When it has id
Then it must contain name
And its value must match the "<pattern>" regex
With this I no longer hit name
in a child property. But this feels like a workaround, rather than a proper solution.
Question:
I have the following Scenario Outline to test for naming convention:
It fails when I try to deploy a NEW resource where a random ID is part of a name. In this case the
name
property isn't populated/known, but there is another child property -route
which is a list of objects where each object has aname
property. As Terraform-Compliance cannot findname
property at the top level it drills down to theroute
property level and finds irrelevantname
properties forcing the rule to FAIL. Here's the sample JSON for the resource-to-be:The error I get is the following:
If this logic is expected, then... is there a way to overcome the behavior and lock the scope for WHEN/THEN (force them to look within current scope)? Maybe a \@lock-scope tag or something?
Many thanks!