Skip to content

Commit 4f050d7

Browse files
martinstibbeevertsdZuhairahmedthemantissa
authored
Release staging v1.5.0 (#901)
* INTMDB-405: [Terraform] Add cluster label to advanced clusters (#857) * Update CHANGELOG.md (#849) * INTMDB-405: Add default label if none supplied * Add test for default label exising * Flatten nested IF statement * Relying on atlas api for unit validation on alert configuration (#862) * INTMDB-334: privatelink endpoint service configurable timeout (#859) * Made timeout for privatelink endpoint service configurable * Updated context to be with timeout, added documentation on how the timeout works * Updated documentation to have proper default timeout of 2h * INTMDB-373: Add new notification parameters to the mongodbatlas_alert_config resource (#877) * Add support for MS Teams SDK webhook * make fmt * Update documentation add Webhook * Update docs * Update to v0.18 * encryption_at_rest M10+ limit doc update (#886) * INTMDB-224: [Terraform] Support AtlasGov with Terraform (#865) * Add Gov variables workflow and test case * Change test pre check to handle gov env variables * Adjust env variable test validation * Add provider parameter for Gov cloud and region_usage_restrictions to datasources * Update project government test update docs * INTMDB-370 -- PIT Restore Example (#870) * INTMDB-369: Updated validation logic for cloud_backup_snapshot_restore_job (#813) * Updated validation logic for cloud_backup_snapshot_restore_job * Fixed lint errors * Updated test-upgrade v110 to use pit restore * Fixed var name in example for pit ts * Updated v110 example to use cloud backup snapshot resource with pit and valid instructions * Removed changes to v110 example and created a v146 example * Fixed the v110 example to work with disk_size requirements and added link to new examples on the tf docs. * Fixed documentation and moved example * Moved example again, and fixed links in documentation * Fixed formatting on example * Fixed formatting to account for removal of disk size * Correct example in test to use arrays and minGram parameter error (#891) * INTMDB-378: Add link for How To Guide for existing container ID (#883) * Add link for How To Guide for existing container ID * Document corrections * 3 remaining doc updates * Update CHANGELOG.md * Update CHANGELOG.md * INTMDB-314 Cluster Tenant Upgrade (#874) * Initial commit for cluster upgrade * Updated to use a custom customizeDiff func * Setting cluster_id and resource ID to the updated values in the case of a cluster upgrade * Updated logic for determining whether upgrade is required * Removed conflation on willUpgrade and tenant changes. Added error checking * Updated cluster docs to denote upgrade support * Added an example tenant upgrade * Fixed formatting issues * Added code to upgrade advanced_cluster * Moved example again, for some reason * Moved examples, got advanced-cluster tenantUpgrade working * Fixed linter issues with advanced cluster * removed unnecessary explicit setting of cluster_id * Updated new examples to work with tf 0.13 * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Addressed some criticisms of new tenant-upgrade examples * Applied suggested docs changes for cluster tenant upgrade * Apply suggestions from code review Applied docs changes suggested for advanced-cluster tenant upgrade readme Co-authored-by: Melissa Plunkett <[email protected]> * Updated cluster tenant upgrade readme to match that of the advanced cluster * Addressed last remaining README suggestions for new examples * Fixed naming on variables and re-pausing cluster after upgrade if necessary * Reduced nested ifs in cluster update * No longer attempting to unpause tenant tier clusters prior to upgrade. Any updates fail * Fixed linter error on bool init Co-authored-by: Melissa Plunkett <[email protected]> * Update CHANGELOG.md * Add additional secret to workflow * Fix failing cluster paused test (#900) * Updated logic for when we pause a cluster * Fixed typo on provider_instance_size_name * Made logic on isUpgradeRequired a bit more concise Co-authored-by: Dosty Everts <[email protected]> Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]>
1 parent 66af3db commit 4f050d7

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

mongodbatlas/resource_mongodbatlas_advanced_cluster.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1134,9 +1134,7 @@ func getUpgradeRequest(d *schema.ResourceData) *matlas.Cluster {
11341134
updatedRegion := updatedSpecs[0].RegionConfigs[0]
11351135
currentSize := currentRegion.ElectableSpecs.InstanceSize
11361136

1137-
if currentRegion.ElectableSpecs.InstanceSize == updatedRegion.ElectableSpecs.InstanceSize || !(currentSize == "M0" ||
1138-
currentSize == "M2" ||
1139-
currentSize == "M5") {
1137+
if currentRegion.ElectableSpecs.InstanceSize == updatedRegion.ElectableSpecs.InstanceSize || !isSharedTier(currentSize) {
11401138
return nil
11411139
}
11421140

mongodbatlas/resource_mongodbatlas_cluster.go

+6-10
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,6 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa
900900
}
901901
}
902902

903-
var didUnpauseCluster = false
904-
905903
if isUpgradeRequired(d) {
906904
updatedCluster, _, err := upgradeCluster(ctx, conn, cluster, projectID, clusterName)
907905

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

927925
_, _, err = updateCluster(ctx, conn, clusterRequest, projectID, clusterName)
928-
929-
didUnpauseCluster = true
930926
}
931927

932928
if err != nil {
@@ -957,7 +953,7 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa
957953
}
958954
}
959955

960-
if didUnpauseCluster {
956+
if d.Get("paused").(bool) && !isSharedTier(d.Get("provider_instance_size_name").(string)) {
961957
clusterRequest := &matlas.Cluster{
962958
Paused: pointy.Bool(true),
963959
}
@@ -1240,14 +1236,14 @@ func flattenProviderSettings(d *schema.ResourceData, settings *matlas.ProviderSe
12401236
}
12411237
}
12421238

1239+
func isSharedTier(instanceSize string) bool {
1240+
return instanceSize == "M0" || instanceSize == "M2" || instanceSize == "M5"
1241+
}
1242+
12431243
func isUpgradeRequired(d *schema.ResourceData) bool {
12441244
currentSize, updatedSize := d.GetChange("provider_instance_size_name")
12451245

1246-
if currentSize == updatedSize {
1247-
return false
1248-
}
1249-
1250-
return currentSize == "M0" || currentSize == "M2" || currentSize == "M5"
1246+
return currentSize != updatedSize && isSharedTier(currentSize.(string))
12511247
}
12521248

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

0 commit comments

Comments
 (0)