Skip to content

Commit b6d1166

Browse files
chore: Remove doc notes of SERVICE_UNAVAILABLE error and redundant logic in check exists (#3286)
* remove doc notes of SERVICE_UNAVAILABLE error and redundant logic in check exists * lint error * remove unnecessary function definition
1 parent dc80fab commit b6d1166

File tree

5 files changed

+3
-24
lines changed

5 files changed

+3
-24
lines changed

docs/guides/advanced-cluster-new-sharding-schema.md

-6
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ resource "mongodbatlas_advanced_cluster" "test" {
8787

8888
This updated configuration will trigger a Terraform update plan. However, the underlying cluster will not face any changes after the `apply` command, as both configurations represent a sharded cluster composed of two shards.
8989

90-
Note: The first time `terraform apply` command is run **after** updating the configuration, you may receive a `500 Internal Server Error (Error code: "SERVICE_UNAVAILABLE")` error. This is a known temporary issue. If you encounter this, please re-run `terraform apply` and this time the update should succeed.
91-
9290
<a id="migration-geosharded"></a>
9391
### Migrate advanced_cluster type `GEOSHARDED`
9492

@@ -197,8 +195,6 @@ resource "mongodbatlas_advanced_cluster" "test" {
197195

198196
This updated configuration triggers a Terraform update plan. However, the underlying cluster will not face any changes after the `apply` command, as both configurations represent a geo sharded cluster with two zones and two shards in each one.
199197

200-
Note: The first time `terraform apply` command is run **after** updating the configuration, you may receive a `500 Internal Server Error (Error code: "SERVICE_UNAVAILABLE")` error. This is a known temporary issue. If you encounter this, please re-run `terraform apply` and this time the update should succeed.
201-
202198
<a id="migration-replicaset"></a>
203199
### Migrate advanced_cluster type `REPLICASET`
204200

@@ -285,8 +281,6 @@ resource "mongodbatlas_advanced_cluster" "test" {
285281
}
286282
```
287283

288-
Note: The first time `terraform apply` command is run **after** updating the configuration, you may receive a `500 Internal Server Error (Error code: "SERVICE_UNAVAILABLE")` error. This is a known temporary issue. If you encounter this, please re-run `terraform apply` and this time the update should succeed.
289-
290284
<a id="use-iss"></a>
291285
## Use Independent Shard Scaling
292286

docs/resources/advanced_cluster (preview provider 2.0.0).md

-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,6 @@ See detailed information for arguments and attributes: [MongoDB API Advanced Clu
935935

936936
~> **IMPORTANT:**
937937
<br> &#8226; When a cluster is imported, the resulting schema structure will always return the new schema including `replication_specs` per independent shards of the cluster.
938-
<br> &#8226; Note: The first time `terraform apply` command is run **after** updating the configuration of an imported cluster, you may receive a `500 Internal Server Error (Error code: "SERVICE_UNAVAILABLE")` error. This is a known temporary issue. If you encounter this, please re-run `terraform apply` and this time the update should succeed.
939938

940939
## Move
941940

docs/resources/advanced_cluster.md

-1
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ See detailed information for arguments and attributes: [MongoDB API Advanced Clu
767767

768768
~> **IMPORTANT:**
769769
<br> &#8226; When a cluster is imported, the resulting schema structure will always return the new schema including `replication_specs` per independent shards of the cluster.
770-
<br> &#8226; Note: The first time `terraform apply` command is run **after** updating the configuration of an imported cluster, you may receive a `500 Internal Server Error (Error code: "SERVICE_UNAVAILABLE")` error. This is a known temporary issue. If you encounter this, please re-run `terraform apply` and this time the update should succeed.
771770

772771
## Considerations and Best Practices
773772

internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func checkExists(resourceName string) resource.TestCheckFunc {
112112
if _, _, err := acc.ConnV2().CloudBackupsApi.GetReplicaSetBackup(context.Background(), ids["project_id"], ids["cluster_name"], ids["snapshot_id"]).Execute(); err != nil {
113113
return fmt.Errorf("cloudBackupSnapshot (%s) does not exist", rs.Primary.Attributes["snapshot_id"])
114114
}
115-
// needed as first call to cluster with new API will fail due to transition to ISS feature flag
116-
if err := acc.CheckExistsClusterHandlingRetry(ids["project_id"], ids["cluster_name"]); err != nil {
115+
116+
if _, _, err := acc.ConnV2().ClustersApi.GetCluster(context.Background(), ids["project_id"], ids["cluster_name"]).Execute(); err != nil {
117117
return fmt.Errorf("cluster (%s : %s) does not exist", ids["project_id"], ids["cluster_name"])
118118
}
119119
return nil

internal/testutil/acc/advanced_cluster.go

+1-14
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,13 @@ func CheckExistsCluster(resourceName string) resource.TestCheckFunc {
103103
if projectID == "" || clusterName == "" {
104104
return fmt.Errorf("projectID or clusterName is empty: %s, %s", projectID, clusterName)
105105
}
106-
if err := CheckExistsClusterHandlingRetry(projectID, clusterName); err != nil {
106+
if _, _, err := ConnV2().ClustersApi.GetCluster(context.Background(), projectID, clusterName).Execute(); err != nil {
107107
return fmt.Errorf("cluster(%s:%s) does not exist: %w", projectID, clusterName, err)
108108
}
109109
return nil
110110
}
111111
}
112112

113-
func CheckExistsClusterHandlingRetry(projectID, clusterName string) error {
114-
return retry.RetryContext(context.Background(), 3*time.Minute, func() *retry.RetryError {
115-
if _, _, err := ConnV2().ClustersApi.GetCluster(context.Background(), projectID, clusterName).Execute(); err != nil {
116-
if admin.IsErrorCode(err, "SERVICE_UNAVAILABLE") {
117-
// retrying get operation because for migration test it can be the first time new API is called for a cluster so API responds with temporary error as it transition to enabling ISS FF
118-
return retry.RetryableError(err)
119-
}
120-
return retry.NonRetryableError(err)
121-
}
122-
return nil
123-
})
124-
}
125-
126113
func CheckFCVPinningConfig(usePreviewProvider bool, resourceName, dataSourceName, pluralDataSourceName string, mongoDBMajorVersion int, pinningExpirationDate *string, fcvVersion *int) resource.TestCheckFunc {
127114
mapChecks := map[string]string{
128115
"mongo_db_major_version": fmt.Sprintf("%d.0", mongoDBMajorVersion),

0 commit comments

Comments
 (0)