Conversation
roneli
left a comment
There was a problem hiding this comment.
Looks good, minor changes + general taughts.
pkg/module/drift/terraform.go
Outdated
| type TFStates []*terraform.Data | ||
|
|
||
| // FindType returns all instances of the given type under a given mode | ||
| func (t TFStates) FindType(tfType, tfMode string) TFInstances { |
There was a problem hiding this comment.
I suggest that tfMode should be an enum, wdyt?
There was a problem hiding this comment.
tfMode filter might be removed because some resources are kept in data mode anyway... in the future we might even have a "this resource is stored under data" flag/whatever in drift.hcl terraform block maybe? I was going to conclude this comment with "it's not efficient use of time", but since it's going to stay one way or another, I'll put it in.
|
|
||
| for k, tfAttrs := range tfAttList { | ||
| cloudAttrs, ok := cloudAttList[k] | ||
| tfMap, cloudMap := tfRes.Map(), differentIDs.Map() |
There was a problem hiding this comment.
Feels like the ResourceList structure could have been defined more effectively perhaps? I noticed in queryIntoResourceList we are creating them we can add them into a smarter data structure that has functions such as Get(id)/ Lookup(type) -> Resources etc' and even a generic compare method between to Resources data structures?
We can do open this in a sperate issue/PR just food for taught while looking at the code.
New usage:
cloudquery drift scan /path/to/file.tfstate