Skip to content

Can you make a tag mandatory provided another tag key/value exists #7483

Answered by thisisshi
timnolan1 asked this question in General
Discussion options

You must be logged in to vote

You can accomplish this with boolean filters, example below:

policies:
- name: find-non-compliant-tagged-resources
  resource: aws.ec2
  description: checks to see if the tag environment is present and \
               if the value is "test" checks that tag tag-test \
               is also present.
  filters:
    - not:
      - or:
        - and:
          - tag:environment: present
          - tag:environment: test
          - tag:test-type: present
        - and:
          - tag:environment: present

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@timnolan1
Comment options

Answer selected by thisisshi
Comment options

You must be logged in to vote
2 replies
@thisisshi
Comment options

@timnolan1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants