How to do a 'not' tag filter?
See original GitHub issueI am trying to figure out how to write a filter that will match on ‘not equal’ to a value.
For example, this works great to filter out all instances with Environment = “Prod”
policies:
- name: list-prod-ec2-instances
resource: ec2
filters:
- tag:Environment: "Prod"
But, how do I write a filter that will list all instances where Environment is NOT “Prod”?
I can see from http://capitalone.github.io/cloud-custodian/docs/filters.html that I should be able to use ‘value filters’ for ‘not-equal’, but I don’t know how to write them in the policy together with ‘tag:Environment’.
I tried the following which did not work:
policies:
- name: list-all-non-prod-ec2-instances
resource: ec2
filters:
- tag:Environment
value: "Prod"
op: ne
policies:
- name: list-all-non-prod-ec2-instances
resource: ec2
filters:
- type: tag
key: Environment
value: "Prod"
op: ne
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Tag and Post Content Filtering
Click the account icon , then click Settings. · Scroll down to the "Filtering" section and click the pencil icon to the right...
Read more >Solved: Filtering for orders with no tag - Shopify Community
Hi you can just paste "NOT tag:*" (without the quotes) to filter only the products/orders that don't have tags. View solution in original...
Read more >Filter but “Not” Tag ? : r/thingsapp
I was hoping there was an easy way to temporarily "hide" tasks with tags (i.e. "Daily routines") that would allow planning for bigger,...
Read more >Can I filter backlog in Azure DevOps by Negating a Tag?
Try the Does Not Contain Operator found in Queries. This can be combined with Contains Operator so you can search for certain tags...
Read more >Filter condition using Tags do not work in Database View ...
Database view reports do not apply filter conditions using Tags. Steps to Reproduce From 'Filter navigator' navigate to Database View 'incident_sla'.
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
short hand form for value is primarily equality, long hand form allows for many other additional operators (not-equal, contains, etc) and value conversions (space/case normalization, date time conversion, etc).
how do we check for a tag:value as follows. tag is Owner Value: someone@xyz.com … @xyz.com has to be checked