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

Example query showing incorrect results #127

Closed
lllama opened this issue Jul 12, 2021 · 3 comments
Closed

Example query showing incorrect results #127

lllama opened this issue Jul 12, 2021 · 3 comments
Assignees

Comments

@lllama
Copy link

lllama commented Jul 12, 2021

The Locate vpcs with no ec2 instances, rds instances lambdas or ENIs attached. query returns all VPCs in my account, including those containing EC2 instances, etc.

Apologies but my SPARQL isn't quite sharp enough to spot the issue.

@jbmchuck jbmchuck self-assigned this Jul 12, 2021
@jbmchuck
Copy link
Contributor

Thanks - I believe the query should be:

select ?account_id ?region_name ?vpc_id
where {
    ?vpc        a                          <alti:aws:ec2:vpc> ;
                <alti:account>             ?account ;
                <alti:region>              ?region ;
                <alti:id>                  ?vpc_id ;
                <alti:is_default>          ?is_default .
    
    ?region     <alti:name>                ?region_name .
    
    ?account    <alti:account_id>          ?account_id .
        
    FILTER NOT EXISTS { ?resource   a                   ?resource_type ;
                                    <alti:vpc>          ?vpc .
                        FILTER ( ?resource_type IN
                            (   
                                <alti:aws:ec2:instance>,
                                <alti:aws:rds:db>,
                                <alti:aws:lambda:function>,
                                <alti:aws:ec2:network-interface>
                            )
                        )
    }                            
}
order by ?account_id ?region_name ?vpc_id

LMK if that works in your environment and I'll update the docs.

@lllama
Copy link
Author

lllama commented Jul 12, 2021

Excellent - thanks! That now returns all of my default VPCs, which is the expected result.

@jbmchuck
Copy link
Contributor

Thanks! Fixed by 236e37f

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

No branches or pull requests

2 participants