Open leventyalcin opened 4 years ago
@leventyalcin On the when clause, try using has instead of contains. The following works perfectly for me:
Scenario Outline: Required Tags are present on all resources which take tags
Given I have resource that supports tags defined
When it has tags
Then it must contain <tags>
And its value must match the "<value>" regex
Examples:
| tags | value |
| name | .+ |
| application | .+ |
| environment | ^(prod\|uat\|dev)$ |
Description : I'm trying to use the Tags example from the documentation. However, I get either wrong results or the tests results are incosistent between sequiential runs.
To Reproduce
It's a long one and I'll add required bits and pieces from the output of
terraform show
terraform-compliance --features ./features/ --planfile ci.tfplan.json
Tried both python and docker executeable
<Your feature/scenario/steps>
Expected behavior : I've tried to few things and I'll try my best to explain.
First try This is my first attempt to use
terraform-compliance
and wanted to see how and if it really fails. Initially I was using the regex patters aswhich means the value of
Name
andservice
tags only can beone alphanumeric
character. However, I was getting the output before except the message was excatly the same with the other tags.Second try
Then started the use the scenario
However, the message I got is this
while the value of
vpc
and there is 24 resources are having the service tag with the value
vpc
. I see no error for that apart from theaws_eip
which has no tag at all.On top of that; the regex for
env
is always^(prod|uat)$
but never fails while the value in the state/plan is alwaysdevops
Tested versions :
terraform-compliance -v terraform-compliance v1.3.6 initiated
terraform -v Terraform v0.13.5 + provider registry.terraform.io/hashicorp/aws v3.14.1
python --version Python 3.8.5