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: Ensures asymmetric auto-scaling is not defined in the cluster when using the old sharding configuration in mongodbatlas_advanced_cluster #2836

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

oarbusi
Copy link
Collaborator

@oarbusi oarbusi commented Nov 27, 2024

Description

Uses old SDK version when the old schema structure is used for mongodbatlas_advanced_cluster

This has been also tested manually creating these 2 clusters:

resource "mongodbatlas_advanced_cluster" "test-node-2" {
  project_id   = var.project_id
  name         = "OLD-SCHEMA-CLUSTER"
  cluster_type = "SHARDED"

  replication_specs {
    num_shards = 2 
    region_configs {
      electable_specs {
        instance_size = "M30"
        disk_iops = 3000
        node_count    = 3
      }
      provider_name = "AWS"
      priority      = 7
      region_name   = "EU_WEST_1"
    }
  }
}

resource "mongodbatlas_advanced_cluster" "test-no-node" {
  project_id   = var.project_id
  name         = "NEW-SCHEMA-CLUSTER"
  cluster_type = "SHARDED"

  replication_specs { # first shard
    region_configs {
      electable_specs {
        instance_size = "M10"
        disk_iops = 3000
        node_count    = 3
      }
      provider_name = "AWS"
      priority      = 7
      region_name   = "EU_WEST_1"
    }
  }

  replication_specs { # second shard
    region_configs {
      electable_specs {
        instance_size = "M10"
        disk_iops = 3000
        node_count    = 3
      }
      provider_name = "AWS"
      priority      = 7
      region_name   = "EU_WEST_1"
    }
  }
}

and then checking for the auto-scaling mode of each cluster.
For the cluster named OLD-SCHEMA-CLUSTER it is "autoScalingMode" : "CLUSTER",
For the cluster named NEW-SCHEMA-CLUSTER it is "autoScalingMode" : "SHARD",

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

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 marked this pull request as ready for review November 27, 2024 15:59
@oarbusi oarbusi requested a review from a team as a code owner November 27, 2024 15:59
@oarbusi oarbusi requested a review from a team as a code owner November 27, 2024 16:05
@oarbusi oarbusi changed the title feat: Uses old SDK version when the old schema structure is used for mongodbatlas_advanced_cluster feat: Ensures asymmetric auto-scaling is not defined in the cluster when using the old sharding configuration in mongodbatlas_advanced_cluster Nov 27, 2024
@lantoli
Copy link
Member

lantoli commented Nov 28, 2024

@oarbusi cc @EspenAlbert as this is a change to adv_cluster that is not done also in tpf, can you please update the readme file so we don't miss to do this in tpf? https://github.com/mongodb/terraform-provider-mongodbatlas/tree/master/internal/service/advancedclustertpf#changes-in-advancedcluster-that-needs-to-be-added-here
thanks

@oarbusi
Copy link
Collaborator Author

oarbusi commented Nov 28, 2024

@lantoli done in bd76cda

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! Some minor suggestions

.changelog/2836.txt Show resolved Hide resolved
Copy link
Contributor

@cveticm cveticm left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link

@corryroot corryroot left a comment

Choose a reason for hiding this comment

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

LGTM!

@oarbusi
Copy link
Collaborator Author

oarbusi commented Dec 2, 2024

Test failure is not related to this PR. Merging anyway

@oarbusi oarbusi merged commit 249c425 into CLOUDP-256272-auto-scaling-per-shard Dec 2, 2024
37 of 38 checks passed
@oarbusi oarbusi deleted the CLOUDP-285705 branch December 2, 2024 13:56
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.

5 participants