Skip to content
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

Merged
merged 53 commits into from
Feb 20, 2024

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Feb 14, 2024

Description

Upgrades advanced_cluster resource to auto-generated SDK

Link to any related issue(s): CLOUDP-229554

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@lantoli lantoli changed the title chore: Upgrades advanced_cluster resource to auto-generated SDK chore: Upgrades advanced_cluster resource to auto-generated SDK Feb 14, 2024
@lantoli lantoli marked this pull request as ready for review February 20, 2024 06:48
@lantoli lantoli requested a review from a team as a code owner February 20, 2024 06:48

if d.HasChange("provider_disk_type_name") {
_, newdiskTypeName := d.GetChange("provider_disk_type_name")
diskTypeName := cast.ToString(newdiskTypeName)
Copy link
Collaborator

@oarbusi oarbusi Feb 20, 2024

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

Copy link
Member Author

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

Copy link
Collaborator

@oarbusi oarbusi left a comment

Choose a reason for hiding this comment

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

LGTM overall

Copy link
Member

@AgustinBettati AgustinBettati left a 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

Comment on lines -275 to +274
if err := d.Set("labels", FlattenLabels(RemoveLabel(cluster.Labels, DefaultLabel))); err != nil {
if err := d.Set("labels", flattenLabels(cluster.GetLabels())); err != nil {
Copy link
Member

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.

Copy link
Member

@AgustinBettati AgustinBettati Feb 20, 2024

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?

Copy link
Member Author

@lantoli lantoli Feb 20, 2024

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

Copy link
Collaborator

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?

Copy link
Member Author

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/model_advanced_cluster.go Outdated Show resolved Hide resolved
internal/service/advancedcluster/model_advanced_cluster.go Outdated Show resolved Hide resolved
Copy link
Member

@AgustinBettati AgustinBettati left a 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

@lantoli lantoli merged commit 3c58898 into master Feb 20, 2024
44 checks passed
@lantoli lantoli deleted the CLOUDP-229554_advanced_cluster branch February 20, 2024 20:45
lantoli added a commit that referenced this pull request Feb 21, 2024
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants