Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow filtering on tag presence and tag absence #16

Open
kalfa opened this issue Jan 27, 2021 · 1 comment
Open

Allow filtering on tag presence and tag absence #16

kalfa opened this issue Jan 27, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@kalfa
Copy link

kalfa commented Jan 27, 2021

Use Case

Filtering against AWS objects which have a specific tag present
Filtering against AWS objects which have a specific tag absent

alternatively, if it is already possible, to add it in the documentation / examples.

Describe the Solution You Would Like

I cannot find any way to select a group of target against the presence of absence of certain tags.

It's quite common to have certain contextual tags, which automatically declare the instance to belong or not to a certain category/group or machine.

In other words adding the ability to express

  • a filter rule which would pass when matching value for a specified tag key (presence of tag)
groups:
  - name:  have_my_tag
    targets:
      - filters
         - name: tag:MyTag
            values: []
  - name:  have_not_my_tag

with an emtpy array, ultimately meaning all the specified values (i.e. empty set) are matching, so the rule is passing

  • a filter rule which would pass when the object has no specified tag key (absence of tag)
groups:
  - name:  have_my_tag
     targets:
      - filters
         - name: tag:MyTag

no values key means it's absent.

of course, I don't mind the yaml way of expressing it, I don't mind any approach.

Describe Alternatives You've Considered

There are no other ways to do it, or at least they are not ducumented / easy to find.

My alternative is changing completely the way we tag objects, to allow aws_inventory to filter, which is not optimal and is a point in favour to look outside bolt.

thanks!

@kalfa kalfa added the enhancement New feature or request label Jan 27, 2021
@kalfa
Copy link
Author

kalfa commented Jan 27, 2021

Just found out that

vaiues:
  - "*"

works for ANY, could it be documetned somewhere explicitly? I know that there is a refernce to AWS filtering, but it's a common use case.
Still cannot find the absent match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant