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

🐛 aws and terraform resource fixes #2051

Merged
merged 2 commits into from
Oct 4, 2023
Merged

🐛 aws and terraform resource fixes #2051

merged 2 commits into from
Oct 4, 2023

Conversation

vjeffrey
Copy link
Contributor

@vjeffrey vjeffrey commented Oct 3, 2023

fixes #2044

run cnquery scan aws and cnquery scan terraform against the server with the asset overview policy is now error free
fixes #2003

@vjeffrey vjeffrey marked this pull request as draft October 3, 2023 03:52
@vjeffrey vjeffrey marked this pull request as ready for review October 3, 2023 06:48
@vjeffrey vjeffrey changed the title 🐛 clean up some of the aws resource init functions 🐛 aws nd terraf'rm resource fixes Oct 3, 2023
@vjeffrey vjeffrey changed the title 🐛 aws nd terraf'rm resource fixes 🐛 aws abd terraform resource fixes Oct 3, 2023
@vjeffrey vjeffrey changed the title 🐛 aws abd terraform resource fixes 🐛 aws and terraform resource fixes Oct 3, 2023
This was referenced Oct 3, 2023
@@ -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")
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

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 :)

Copy link
Contributor Author

@vjeffrey vjeffrey Oct 3, 2023

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

Copy link
Contributor Author

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>
	* 
	````

@vjeffrey vjeffrey force-pushed the vj/initfixes branch 2 times, most recently from 99017b5 to 8f23fd7 Compare October 3, 2023 23:14
@vjeffrey vjeffrey merged commit a17b7c6 into main Oct 4, 2023
10 checks passed
@vjeffrey vjeffrey deleted the vj/initfixes branch October 4, 2023 15:12
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v9 aws issues v9 terraform scan errors
3 participants