Test all of the values in a map with mql #678
Replies: 3 comments 1 reply
-
Can you share the HCL snippet as an example? I am not 100% sure I understand what you want to test for. |
Beta Was this translation helpful? Give feedback.
-
module "uniform_bucket_level_access_fail" {
source = "terraform-google-modules/cloud-storage/google"
prefix = "uniform-bucket-level-access-fail-"
names = [ "module" ]
project_id = var.project_id
location = var.location
bucket_policy_only = {
module = false
}
} |
Beta Was this translation helpful? Give feedback.
-
We have a really nice solution for this with properly structured maps, but it turns out the testing for dict's (i.e. parsed JSON or in this case HCL structures) is quite restricting. You can still run the test via accessing all the |
Beta Was this translation helpful? Give feedback.
-
I am trying to test the arguments of a
terraform.module
whose value is a map of key-value pairs. The example I have only has one key calledmodule
defined, but the way the module is written, you can have as many keys as you want.I know I can write at query that explicitly tests the key that defined
block.arguments['bucket_policy_only']['module'] != false
but the key can be any string.How do I test all of the values that are defined? 🤔
Beta Was this translation helpful? Give feedback.
All reactions