Last active
September 15, 2021 21:59
-
-
Save judell/c3567d6d0e23e0e8e61a72ea4edaca2e to your computer and use it in GitHub Desktop.
PATTERN: UNION similar things to combine them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select title, id, resource from | |
( | |
select | |
title, | |
key_pair_id as id, | |
'aws_ec2_key_pair' as resource, | |
tags | |
from | |
aws_ec2_key_pair | |
union | |
select | |
title, | |
instance_id as id, | |
'aws_ec2_instance' as resource, | |
tags | |
from | |
aws_ec2_instance | |
) as untagged | |
where | |
untagged.tags ->> 'owner' is null | |
or untagged.tags ->> 'projectid' is null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment