@@ -3,15 +3,10 @@ package mongodbatlas
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "log"
7
6
"net/http"
8
- "time"
9
7
10
8
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
11
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
12
9
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
13
- "github.com/spf13/cast"
14
- matlas "go.mongodb.org/atlas/mongodbatlas"
15
10
)
16
11
17
12
func dataSourceMongoDBAtlasCluster () * schema.Resource {
@@ -330,25 +325,6 @@ func dataSourceMongoDBAtlasClusterRead(ctx context.Context, d *schema.ResourceDa
330
325
return diag .FromErr (fmt .Errorf (errorClusterRead , clusterName , err ))
331
326
}
332
327
333
- if cluster .ProviderSettings != nil && (cast .ToString (cluster .ProviderSettings .ProviderName ) == "AWS" ||
334
- cast .ToString (cluster .ProviderSettings .ProviderName ) == "AZURE" ) {
335
- stateConf := & resource.StateChangeConf {
336
- Pending : []string {"PRIVATE_ENDPOINTS_NIL" , "PRIVATE_ENDPOINTS_EMPTY" },
337
- Target : []string {"PRIVATE_ENDPOINTS_EXISTS" , "NORMAL" },
338
- Refresh : datasourceClusterPrivateEndpointRefreshFunc (clusterName , projectID , conn ),
339
- Timeout : 10 * time .Minute ,
340
- MinTimeout : 1 * time .Minute ,
341
- Delay : 3 * time .Minute ,
342
- }
343
-
344
- resp , err := stateConf .WaitForStateContext (ctx )
345
- if err != nil {
346
- log .Printf ("[ERROR] %v" , fmt .Errorf (errorClusterRead , clusterName , err ))
347
- } else {
348
- cluster = resp .(* matlas.Cluster )
349
- }
350
- }
351
-
352
328
if err := d .Set ("auto_scaling_disk_gb_enabled" , cluster .AutoScaling .DiskGBEnabled ); err != nil {
353
329
return diag .FromErr (fmt .Errorf (errorClusterSetting , "auto_scaling_disk_gb_enabled" , clusterName , err ))
354
330
}
@@ -458,35 +434,3 @@ func dataSourceMongoDBAtlasClusterRead(ctx context.Context, d *schema.ResourceDa
458
434
459
435
return nil
460
436
}
461
-
462
- func datasourceClusterPrivateEndpointRefreshFunc (name , projectID string , client * matlas.Client ) resource.StateRefreshFunc {
463
- return func () (interface {}, string , error ) {
464
- cluster , resp , err := client .Clusters .Get (context .Background (), projectID , name )
465
-
466
- if err != nil && cluster == nil && resp == nil {
467
- return nil , "" , err
468
- } else if err != nil {
469
- if resp .StatusCode == 404 {
470
- return "" , "DELETED" , nil
471
- }
472
- if resp .StatusCode == 503 {
473
- return "" , "PENDING" , nil
474
- }
475
- return nil , "" , err
476
- }
477
-
478
- if cluster .ConnectionStrings != nil {
479
- if cluster .ConnectionStrings .PrivateEndpoint == nil {
480
- return cluster , "PRIVATE_ENDPOINTS_NIL" , nil
481
- }
482
- if cluster .ConnectionStrings .PrivateEndpoint != nil && len (cluster .ConnectionStrings .PrivateEndpoint ) == 0 {
483
- return cluster , "PRIVATE_ENDPOINTS_EMPTY" , nil
484
- }
485
- if cluster .ConnectionStrings .PrivateEndpoint != nil && len (cluster .ConnectionStrings .PrivateEndpoint ) != 0 {
486
- return cluster , "PRIVATE_ENDPOINTS_EXISTS" , nil
487
- }
488
- }
489
-
490
- return cluster , "NORMAL" , nil
491
- }
492
- }
0 commit comments