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

feat: Support replica_set_scaling_strategy in mongodbatlas_advanced_cluster #2539

Merged
merged 12 commits into from
Sep 9, 2024

Conversation

oarbusi
Copy link
Collaborator

@oarbusi oarbusi commented Aug 29, 2024

Description

Supports replica_set_scaling_strategy in mongodbatlas_advanced_cluster.

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

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. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • 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 have added appropriate changelog entries.
  • 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

@oarbusi oarbusi changed the title feat: Support replica_set_scaling_strategy in mongodbatlas_cluster and mongodbatlas_advanced_cluster feat: Support replica_set_scaling_strategy in mongodbatlas_advanced_cluster Sep 2, 2024
@oarbusi oarbusi marked this pull request as ready for review September 5, 2024 14:40
@oarbusi oarbusi requested review from a team as code owners September 5, 2024 14:40
Copy link
Contributor

github-actions bot commented Sep 5, 2024

APIx bot: a message has been sent to Docs Slack channel

@oarbusi oarbusi merged commit 2a4e4ac into master Sep 9, 2024
35 checks passed
@oarbusi oarbusi deleted the CLOUDP-261476 branch September 9, 2024 07:14
svc-apix-Bot added a commit that referenced this pull request Sep 9, 2024
Comment on lines +320 to +322
if err := d.Set("replica_set_scaling_strategy", clusterDescLatest.GetReplicaSetScalingStrategy()); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "replica_set_scaling_strategy", clusterName, err))
}
Copy link
Member

Choose a reason for hiding this comment

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

For the case of both data sources I believe we are only handling the case when the user defines use_replication_spec_per_shard = true, but if we want to handle all cases we should also consider the other path as done in the resource. Would suggest adjusting configReplicaSetScalingStrategyOldSchema to use data source without this option so it is captured there as well.

Comment on lines +538 to 550
cluster, resp, err := connV2.ClustersApi.GetCluster(ctx, projectID, clusterName).Execute()
if err != nil {
if resp != nil && resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}
return diag.FromErr(fmt.Errorf(errorRead, clusterName, err))
}
if err := d.Set("replica_set_scaling_strategy", cluster.GetReplicaSetScalingStrategy()); err != nil {
return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "replica_set_scaling_strategy", clusterName, err))
}

zoneNameToZoneIDs, err := getZoneIDsFromNewAPI(ctx, projectID, clusterName, connV2)
Copy link
Member

Choose a reason for hiding this comment

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

getZoneIDsFromNewAPI is doing a get to the new API, if we are now doing the call from outside now we can pass the result directly to this function to avoid 2 same calls.

lantoli added a commit that referenced this pull request Sep 10, 2024
* master:
  doc: Adds 1.19.0 release upgrade guide (#2564)
  chore: Updates CHANGELOG.md for #2528
  feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528)
  chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571)
  doc: Adds support for SDK_BRANCH in schema generation (#2562)
  update git workflow (#2572)
  chore: Updates CHANGELOG.md for #2566
  feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566)
  chore: Updates CHANGELOG.md for #2569
  chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569)
  chore: Updates CHANGELOG.md for #2568
  doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567)
  fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568)
  chore: Updates CHANGELOG.md for #2539
  feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539)
  adding changelog entry for 1.18.1 to avoid confusion (#2561)

# Conflicts:
#	internal/provider/provider.go
lantoli added a commit that referenced this pull request Sep 10, 2024
* master:
  doc: Adds 1.19.0 release upgrade guide (#2564)
  chore: Updates CHANGELOG.md for #2528
  feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528)
  chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571)
  doc: Adds support for SDK_BRANCH in schema generation (#2562)
  update git workflow (#2572)
  chore: Updates CHANGELOG.md for #2566
  feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566)
  chore: Updates CHANGELOG.md for #2569
  chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569)
  chore: Updates CHANGELOG.md for #2568
  doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567)
  fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568)
  chore: Updates CHANGELOG.md for #2539
  feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539)
  adding changelog entry for 1.18.1 to avoid confusion (#2561)

# Conflicts:
#	internal/provider/provider.go
lantoli added a commit that referenced this pull request Sep 10, 2024
* master:
  doc: Adds 1.19.0 release upgrade guide (#2564)
  chore: Updates CHANGELOG.md for #2528
  feat: Supports change_stream_options_pre_and_post_images_expire_after_seconds in `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster` (#2528)
  chore: Disables preview mode for EAR private endpoint so it may be normally accessible (#2571)
  doc: Adds support for SDK_BRANCH in schema generation (#2562)
  update git workflow (#2572)
  chore: Updates CHANGELOG.md for #2566
  feat: Adds `mongodbatlas_stream_processor` resource and data sources (#2566)
  chore: Updates CHANGELOG.md for #2569
  chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master (#2569)
  chore: Updates CHANGELOG.md for #2568
  doc: Includes sync_creation into mongodbatlas_online_archive resource documentation (#2567)
  fix: Sets correct `zone_id` when `use_replication_spec_per_shard` is false and refactors `replica_set_scaling_strategy` handling with old schema of advanced cluster (#2568)
  chore: Updates CHANGELOG.md for #2539
  feat: Support `replica_set_scaling_strategy` in `mongodbatlas_advanced_cluster` (#2539)
  adding changelog entry for 1.18.1 to avoid confusion (#2561)

# Conflicts:
#	internal/provider/provider.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants