Skip to content

Conversation

@austbot
Copy link
Collaborator

@austbot austbot commented Dec 6, 2020

@zparnold I have a POC on this. Please let me know if you like this direction and I will finish

The basic Idea here is move the logic of determinig what Priceable assets match the Change.Type(s) into the actual pricer files. This lets main be more generic and removes the big switch.

I want to see if you like this direction before I keep going. The next Idea was to do the following.

  • Move assets/asset classes (azure Assets or Azure vms) (depending on how granular we want) into their own packages and us the init() magic to have them register themselves with the TerraformAssetPricer
  • Make a new error class of InestiableResourceError to represent the error when we cant estimate and make a single AssetPricer for that.
  • Create a price result struct that stores the Change.Address so that we can price individual resources(line item break down) in the future. Main then can loop over price results and show total, cost by resource, cost by X thing

@austbot austbot added the WIP Dont Merge label Dec 6, 2020
@zparnold
Copy link
Owner

zparnold commented Dec 6, 2020

I don't think I follow based on reading your code, but I do like the provider registration approach. Does it turn into a map or using reflection to match the type it needs to price? I'm a bit confused on what the difference between a TerraformPriceableAsset and an AzurePriceableAsset is? Maybe we can setup a call and talk through this. Like I said, I think I like the direction I just need audible words to understand it. My brain is mush after these exams 😂

@zparnold
Copy link
Owner

zparnold commented Dec 6, 2020

Does this address #7 ?

@austbot
Copy link
Collaborator Author

austbot commented Dec 6, 2020

No reflection it just takes the change type and matches that string to anything coming from keys() method.

Azure priceable asset was something you made to help the code work with generate query.

The terrform priceable asset allows any change from tf to turn into a priceable

  • from my iphone

@austbot
Copy link
Collaborator Author

austbot commented Dec 6, 2020

Does this address #7 ?

Yes hence me tagging #7

@austbot
Copy link
Collaborator Author

austbot commented Dec 13, 2020

@zparnold okay finished implementation, I need to mrege conflicts but what do you think?

)

func init() {
ctx := context.Background()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zparnold here is the init register. This allows us to add packages without touching main.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP Dont Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants