-
Notifications
You must be signed in to change notification settings - Fork 188
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
fix: Sets replication_specs IDs when updating them. #1876
Conversation
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.
LGTM
@@ -850,6 +850,10 @@ func expandAdvancedReplicationSpec(tfMap map[string]any) *matlas.AdvancedReplica | |||
RegionConfigs: expandRegionConfigs(tfMap["region_configs"].([]any)), | |||
} | |||
|
|||
if tfMap["id"].(string) != "" { |
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.
Just to confirm, we are setting the id in update request of mongodbatlas_cluster
resource right?
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.
@AgustinBettati this method is called in both update and create. The reason why it should only run on the update is because of the if itself. I am assuming that at the creation phase this field is empty. Any concerns?
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.
The function is called expandAdvancedReplicationSpec
but this PR is also updating the cluster test 🤔 . Is expandAdvancedReplicationSpec
called also in the cluster resource? if not, is the cluster resource already sending the id
during the update?
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.
Yes that statement seems correct to me. My doubt was more related to how we handle this id in mongodbatlas_cluster
, not a blocker just something to keep in mind.
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.
The function is called expandAdvancedReplicationSpec but this PR is also updating the cluster test
@andreaangiolillo @AgustinBettati
Adding tests to cluster
was more like to increase test coverage. Sorry if it created confusion. confirming that expandAdvancedReplicationSpec
is only affecting advanced_cluster
.
regarding cluster: that is a completely different story: while in here we use list, in that one we are representing replication_specs as a set and we're also using v1.0 - I added the test on purpose: to see if it was able to handle replicationspecs updates and indeed it does without having to change the logic.
@@ -850,6 +850,10 @@ func expandAdvancedReplicationSpec(tfMap map[string]any) *matlas.AdvancedReplica | |||
RegionConfigs: expandRegionConfigs(tfMap["region_configs"].([]any)), | |||
} | |||
|
|||
if tfMap["id"].(string) != "" { |
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.
The function is called expandAdvancedReplicationSpec
but this PR is also updating the cluster test 🤔 . Is expandAdvancedReplicationSpec
called also in the cluster resource? if not, is the cluster resource already sending the id
during the update?
Description
Passes the replicationSpec item id to the PATCH request during updates. This fixes the error:
Link to any related issue(s): CLOUDP-227483
Type of change:
Required Checklist:
Further comments