-
Notifications
You must be signed in to change notification settings - Fork 160
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
Extract metadata from enumeration pkg #1572
Conversation
elie.tf
Outdated
@@ -0,0 +1,23 @@ | |||
provider "aws" { | |||
region = "us-east-1" |
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 you added this file by mistake ?
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.
Oh yeah good catch thanks a lot
@@ -69,7 +70,7 @@ func (e *S3BucketAnalyticEnumerator) Enumerate() ([]*resource.Resource, error) { | |||
string(e.SupportedType()), | |||
id, | |||
map[string]interface{}{ | |||
"region": region, | |||
"alias": region, |
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.
no sure I understand this change ˆˆ
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.
Those tests were broken due to removal of SetResolveReadAttributesFunc. Sometimes in those methods we were casting field from different types to string. If we loose that case it causes some issues since in the detail fetcher we only take into account strings attributes. To fix that I added some cast directly in the detail fetcher. That should not cause any issues to retrieve details if we send additional (useless) fields to the ReadResource call.
d54e9e6
to
a18af39
Compare
Codecov Report
@@ Coverage Diff @@
## main #1572 +/- ##
==========================================
- Coverage 83.81% 78.86% -4.96%
==========================================
Files 179 219 +40
Lines 6131 6918 +787
==========================================
+ Hits 5139 5456 +317
- Misses 847 1266 +419
- Partials 145 196 +51
|
Description
Metadata are now in driftctl pkg.
I removed completely func
SetResolveReadAttributesFunc
, attributes set in the enumerator are now used as it byt the detail fetcher.The main issue was that the detail fetcher was only using string attributes in ReadResource, so I added some casting logic in it (see latest commits on tests fix).
This had some side effects on following resources:
aws_network_acl_rule
(and by heritance we also had impact onaws_network_acl
too)aws_cloudformation_stack
aws_security_group_rule
I added a normalization pass on driftctl side after the remote scan to apply normalization. No now we retrieve resources then normalize them instead of doing the normalization directly while retrieving resources. That's why now there is two resource factories, one in enum pkg that only create the struct but without any modification. We got another factory in drifctl that is applying normalization.
All golden files rename can be ommited in the review, it's a side effect to have more attributes fields. Because now we are not only using fields from
SetResolveReadAttributesFunc
. That should not cause any issues to retrieve details if we send additional (useless) fields to theReadResource
call.