-
Notifications
You must be signed in to change notification settings - Fork 192
refactor: Updates advanced_cluster tpf plan_modifier auto_scaling removed logic #3213
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,20 @@ import ( | |
) | ||
|
||
var attributePlanModifiers = map[string]customplanmodifier.UnknownReplacementCall[PlanModifyResourceInfo]{ | ||
"mongo_db_version": mongoDBVersionReplaceUnknown, | ||
"mongo_db_version": mongoDBVersionReplaceUnknown, | ||
"auto_scaling": autoScalingReplaceUnknown, | ||
"analytics_auto_scaling": autoScalingReplaceUnknown, | ||
// TODO: Add the other computed attributes | ||
} | ||
|
||
func autoScalingReplaceUnknown(ctx context.Context, state customplanmodifier.ParsedAttrValue, req *customplanmodifier.UnknownReplacementRequest[PlanModifyResourceInfo]) attr.Value { | ||
// don't use auto_scaling or analytics_auto_scaling from state if it's not enabled as it doesn't need to be present in Update request payload | ||
if req.Info.AutoScalingComputedUsed || req.Info.AutoScalingDiskUsed { | ||
return state.AsObject() | ||
} | ||
return req.Unknown | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the logic to affect other elements when autoscale is enabled, e.g. keepUnkownFuncWithNonEmptyAutoScaling is not implemented yet, is that correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, not implemented. Will be done in CLOUDP-308783 |
||
} | ||
|
||
func mongoDBVersionReplaceUnknown(ctx context.Context, state customplanmodifier.ParsedAttrValue, req *customplanmodifier.UnknownReplacementRequest[PlanModifyResourceInfo]) attr.Value { | ||
if req.Changes.AttributeChanged("mongo_db_major_version") { | ||
return req.Unknown | ||
|
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.
this is only called if plan is unknown, right?
nice the new approach, less verbose and easier to understand
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.
Correct 👍