-
Notifications
You must be signed in to change notification settings - Fork 178
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
chore: Upgrades advanced_cluster
resource to auto-generated SDK
#1947
Conversation
advanced_cluster
resource to auto-generated SDKadvanced_cluster
resource to auto-generated SDK
|
||
if d.HasChange("provider_disk_type_name") { | ||
_, newdiskTypeName := d.GetChange("provider_disk_type_name") | ||
diskTypeName := cast.ToString(newdiskTypeName) |
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.
more of a general comment: I see cast.ToString/Bool/etc being used a lot and also see .(bool)/.(string)/etc being used. I think the latter is the more idiomatic way of casting in Go and in my opinion more clear. WDYT? No need to change in this PR but I think we should probably only use one of the ways moving forward
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.
you're totally right, it's something i also discussed with @gssbzn that we're using both styles all across the code and we might want to unify
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 overall
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.
main comment to double check is the one related to accept_data_risks_and_force_replica_set_reconfig
if err := d.Set("labels", FlattenLabels(RemoveLabel(cluster.Labels, DefaultLabel))); err != nil { | ||
if err := d.Set("labels", flattenLabels(cluster.GetLabels())); err != nil { |
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.
When removing the logic of handling the default label, how does this impact existing terraform state/clusters? I see the risk that now that the read does not filter out the default label, users could encounter a non empty plan.
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 expander and flattener have the logic of removing/validating this default label, so the only change is that now in the create we do not add this default label. Would this be correct?
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, the logic has been simplified but we're keeping the logic to filter out the special label so no unexpected plans will happen
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.
@lantoli Wanted to call out that we currently mention in the documentation for cluster and advanced cluster that users should not set Infrastructure Tool
label, should we update this in documentation as well?
Key-value pairs that categorize the cluster. Each key and value has a maximum length of 255 characters. You cannot set the key `Infrastructure Tool`, it is used for internal purposes to track aggregate usage. |
Or can users still not set it based on the logic?
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've kept that behavior so the doc is correct, user will get an error if trying to set that label
internal/service/advancedcluster/resource_advanced_cluster_migration_test.go
Outdated
Show resolved
Hide resolved
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, thanks for the follow ups
…st groups that must be executed before merging
* master: chore: Bump dorny/paths-filter from 3.0.0 to 3.0.1 (#1964) chore: Bump github.com/aws/aws-sdk-go from 1.50.17 to 1.50.22 (#1965) chore: Upgrades `advanced_cluster` resource to auto-generated SDK (#1947) fix: mongodbatlas_encryption_at_rest resource with google_cloud_kms_config (#1962) chore: Restores atlas streams guide in examples section (#1958) chore: Signs created tag during release process (#1960)
Description
Upgrades
advanced_cluster
resource to auto-generated SDKLink to any related issue(s): CLOUDP-229554
Type of change:
Required Checklist:
Further comments