terraform-compliance / cli

a lightweight, security focused, BDD test framework against terraform.
https://terraform-compliance.com
MIT License
1.34k stars 151 forks source link

Applying test cases to only resources from specific provider #705

Closed Conacious closed 1 year ago

Conacious commented 1 year ago

Question:

Hi, Following your example with tags I was wondering if, somehow you can apply tests only to the resources from a specific provider.

I saw this example in the docs, but it is not working for me:

Given I have any resource defined
When its provider_name is aws
...

When trying that with AWS Terraform resources mixed with Datadog Terraform resources I get:

* SKIPPING: Can not find aws provider_name in aws_iam_policy.dynamodb_read_policy, aws_instance.my_instance, aws_security_group.sg_instance,

So I was wondering if there is any way to filter by provider.

Thank you!

Conacious commented 1 year ago

OK, so I guess it is just a matter of improving the documentation... I made it using:

When its provider_name is registry.terraform.io/hashicorp/aws

Thank you, I will close the issue :D