How to get resources with a value inside any keys
See original GitHub issueHi! I’m trying to write a policy that finds aws vpn connection tunnels that have no tunnels up. When searching for tunnels without any filters the resources.json look like this:
[
{
(lots of stuff here)
"VgwTelemetry": [
{
"AcceptedRouteCount": 3,
"LastStatusChange": "2020-06-24T04:33:19+00:00",
"OutsideIpAddress": "1.1.1.1",
"Status": "UP",
"StatusMessage": ""
},
{
"AcceptedRouteCount": 3,
"LastStatusChange": "2020-06-07T19:41:11+00:00",
"OutsideIpAddress": "1.1.1.2",
"Status": "DOWN",
"StatusMessage": ""
}
]
}
]
Basically what I’m trying to do is filter resources that have no "Status": "UP"
keys in them. I tried to do something like this:
- name: aws-vpnconnection-alltunnelsaredown-find
description: |
Find connections with no tunnels up
resource: aws.vpn-connection
filters:
- not:
- VgwTelemetry.[*].Status: UP
But this doesn’t seem to work. What is the proper way to do this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
c# - How to get a value from resource file using its key
There is a much easier way: Namespace.Properties.Resources.FileName -> gets the string of the file ...
Read more >How to Get All Keys in Redis | Tutorial by Chartio
This is best shown through the redis-cli (command line interface) using GET and SET commands. For example, we may want to store some...
Read more >Object.keys() - JavaScript - MDN Web Docs
The Object.keys() method returns an array of a given object's own enumerable string-keyed property names.
Read more >JavaScript: Obtain key-value pairs in an array - Flexiple
Method 1: Using an object to store key => value pairs ; // create object var obj = {}; ; // Loop to...
Read more >Creating a condition with multiple keys or values
Unless otherwise specified, all keys can have multiple values. ... For example, you can tag resources in AWS and include multiple tag key-value...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
so because the value comes back as an array from expression, comparing to a singleton policy value won’t match for equality, you’ll need to use the long form of the value filter.
its useful to try out jmespath-terminal package for exploring this locally with the cli
VgwTelemetry[].Status: DOWN