-
Notifications
You must be signed in to change notification settings - Fork 23
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
🐛 aws and terraform resource fixes #2051
Conversation
providers/aws/resources/aws_s3.go
Outdated
@@ -198,7 +204,7 @@ func (a *mqlAwsS3Bucket) policy() (*mqlAwsS3BucketPolicy, error) { | |||
} | |||
|
|||
// no bucket policy found, return nil for the policy | |||
return &mqlAwsS3BucketPolicy{}, nil | |||
return nil, errors.New("no policy found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we returning an error and not just nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, good point. ill check that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a NilData would be great because no policy is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi: we might have to set the field in this case (ie: TValue[T]{State: StateIsNull | StateIsSet, Error: err}
). The hard thing here is that I had a hard time detecting with go if something is actually nil, because the nil gets wrapped in other types. I'll help solve this in the future to make it clear, but for now just set the TValue manually and return nil, nil if you need this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 pushed up the fix - er, actually, nevermind - pushing up fix in a few
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, this resource is giving me issues when nil
cnquery> aws.s3.buckets { policy.id}
1 error occurred:
* cannot cast resource to resource type: <nil>
*
````
99017b5
to
8f23fd7
Compare
fixes #2044
run cnquery scan aws and cnquery scan terraform against the server with the asset overview policy is now error free
fixes #2003