-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: Commitments and commitment assignments support #300
Conversation
LGTM |
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 see that the api responses converted to tf resources in an unconventional way. Other resources follow a flow of api call -> flattenXYZ/expandXYZ -> set to state. Though that mapping logic is well polished and not bad I think it would make sense to follow common convention with flatten/expand functions.
What do you think?
As discussed during the meeting - I don't follow the flatten/expand convention as I figured out that Terraform SDK uses https://github.com/mitchellh/mapstructure under the hood. So instead of mapping API types to Also, as agreed, I did the following changes (in #302 and #304 as well):
|
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.
Thank you for adding extensive tests. Feel free to merge after you address comments however way you think best.
* types preparation * more mapping impls for azure * working import + update * fix getReservationResources * add term mapping to MapReservationImportToResource to mimic API's behavior * fix tests * TestMapCommitmentToReservationResource * rename * mapping functions tests * working first step of acc test * CheckDestroy * working state import step * working azure acceptance tests * get rid of the dummy test * add usage examples * fix populateCommitmentsResourceData * full acc tests * get rid of productname from the matcher * flatten matcher * regenerate docs * format tf * regenerate docs * add descriptions * MapConfigsToCommitments impl * regenerate docs * newline * return err from MapReservationImportToResource * get rid of attr schema config * use common fields for cast ai commitment fields * flatten the structure, get rid of the separate commitments package * regenerate sdk * renames * renames * dont export mapping functions * dont export field names * Feature: Commitment assignments support (#304) * working assignments * add example * adjust tests * more test adjustments * add config nil check * priority computed field * regenerate docs * fix replacing assignments * working acceptance tests with assignments for gke * add assignment checks * azure assignments acc tests * rearrange acc tests * use common fields for cast ai commitment fields * flatten the structure, get rid of the separate commitments package * renames * renames * imports fix * renames * dont export field names --------- Co-authored-by: Max Twardowski <[email protected]> --------- Co-authored-by: Max Twardowski <[email protected]>
The purpose of this PR is to ship a new resource type responsible for CAST AI's commitments and commitment assignments provisioning.