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

Release staging v1.5.0 #901

Merged
merged 17 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mongodbatlas/resource_mongodbatlas_advanced_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,7 @@ func getUpgradeRequest(d *schema.ResourceData) *matlas.Cluster {
updatedRegion := updatedSpecs[0].RegionConfigs[0]
currentSize := currentRegion.ElectableSpecs.InstanceSize

if currentRegion.ElectableSpecs.InstanceSize == updatedRegion.ElectableSpecs.InstanceSize || !(currentSize == "M0" ||
currentSize == "M2" ||
currentSize == "M5") {
if currentRegion.ElectableSpecs.InstanceSize == updatedRegion.ElectableSpecs.InstanceSize || !isSharedTier(currentSize) {
return nil
}

Expand Down
16 changes: 6 additions & 10 deletions mongodbatlas/resource_mongodbatlas_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,6 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa
}
}

var didUnpauseCluster = false

if isUpgradeRequired(d) {
updatedCluster, _, err := upgradeCluster(ctx, conn, cluster, projectID, clusterName)

Expand All @@ -925,8 +923,6 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa
}

_, _, err = updateCluster(ctx, conn, clusterRequest, projectID, clusterName)

didUnpauseCluster = true
}

if err != nil {
Expand Down Expand Up @@ -957,7 +953,7 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa
}
}

if didUnpauseCluster {
if d.Get("paused").(bool) && !isSharedTier(d.Get("provider_instance_size_name").(string)) {
clusterRequest := &matlas.Cluster{
Paused: pointy.Bool(true),
}
Expand Down Expand Up @@ -1240,14 +1236,14 @@ func flattenProviderSettings(d *schema.ResourceData, settings *matlas.ProviderSe
}
}

func isSharedTier(instanceSize string) bool {
return instanceSize == "M0" || instanceSize == "M2" || instanceSize == "M5"
}

func isUpgradeRequired(d *schema.ResourceData) bool {
currentSize, updatedSize := d.GetChange("provider_instance_size_name")

if currentSize == updatedSize {
return false
}

return currentSize == "M0" || currentSize == "M2" || currentSize == "M5"
return currentSize != updatedSize && isSharedTier(currentSize.(string))
}

func expandReplicationSpecs(d *schema.ResourceData) ([]matlas.ReplicationSpec, error) {
Expand Down