diff --git a/internal/service/alertconfiguration/resource_alert_configuration.go b/internal/service/alertconfiguration/resource_alert_configuration.go index 29b72498f1..9840cacb37 100644 --- a/internal/service/alertconfiguration/resource_alert_configuration.go +++ b/internal/service/alertconfiguration/resource_alert_configuration.go @@ -520,7 +520,7 @@ func (r *alertConfigurationRS) Update(ctx context.Context, req resource.UpdateRe } func (r *alertConfigurationRS) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - conn := r.Client.Atlas + connV2 := r.Client.AtlasV2 var alertConfigState TfAlertConfigurationRSModel resp.Diagnostics.Append(req.State.Get(ctx, &alertConfigState)...) @@ -530,7 +530,7 @@ func (r *alertConfigurationRS) Delete(ctx context.Context, req resource.DeleteRe ids := conversion.DecodeStateID(alertConfigState.ID.ValueString()) - _, err := conn.AlertConfigurations.Delete(ctx, ids[EncodedIDKeyProjectID], ids[EncodedIDKeyAlertID]) + _, err := connV2.AlertConfigurationsApi.DeleteAlertConfiguration(ctx, ids[EncodedIDKeyProjectID], ids[EncodedIDKeyAlertID]).Execute() if err != nil { resp.Diagnostics.AddError(errorReadAlertConf, err.Error()) } diff --git a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go index 0da3e4a58f..9d704b4bd0 100644 --- a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go +++ b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go @@ -162,14 +162,14 @@ func resourceDelete(ctx context.Context, d *schema.ResourceData, meta any) diag. } func resourceImportState(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { - conn := meta.(*config.MongoDBClient).Atlas + conn := meta.(*config.MongoDBClient).AtlasV2 projectID, id, err := splitImportID(d.Id()) if err != nil { return nil, err } - _, _, err = conn.CloudProviderSnapshotExportBuckets.Get(ctx, *projectID, *id) + _, _, err = conn.CloudBackupsApi.GetExportBucket(ctx, *projectID, *id).Execute() if err != nil { return nil, fmt.Errorf("couldn't import snapshot export bucket %s in project %s, error: %s", *id, *projectID, err) } diff --git a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job.go b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job.go index 246d536df8..543f13cd7f 100644 --- a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job.go +++ b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job.go @@ -290,7 +290,7 @@ func expandExportJobCustomData(d *schema.ResourceData) *[]admin.BackupLabel { } func resourceImportState(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { - conn := meta.(*config.MongoDBClient).Atlas + connV2 := meta.(*config.MongoDBClient).AtlasV2 parts := strings.SplitN(d.Id(), "--", 3) if len(parts) != 3 { @@ -301,7 +301,7 @@ func resourceImportState(ctx context.Context, d *schema.ResourceData, meta any) clusterName := parts[1] exportID := parts[2] - _, _, err := conn.CloudProviderSnapshotExportJobs.Get(ctx, projectID, clusterName, exportID) + _, _, err := connV2.CloudBackupsApi.GetBackupExportJob(ctx, projectID, clusterName, exportID).Execute() if err != nil { return nil, fmt.Errorf("couldn't import snapshot export job %s in project %s and cluster %s, error: %s", exportID, projectID, clusterName, err) } diff --git a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go index 721b12c7c3..99125326f6 100644 --- a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go +++ b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go @@ -82,7 +82,7 @@ func checkExists(resourceName string) resource.TestCheckFunc { if err != nil { return err } - _, _, err = acc.Conn().CloudProviderSnapshotExportJobs.Get(context.Background(), projectID, clusterName, exportJobID) + _, _, err = acc.ConnV2().CloudBackupsApi.GetBackupExportJob(context.Background(), projectID, clusterName, exportJobID).Execute() if err == nil { return nil } diff --git a/internal/service/onlinearchive/resource_online_archive.go b/internal/service/onlinearchive/resource_online_archive.go index 5f9b17b12b..1e93c832d8 100644 --- a/internal/service/onlinearchive/resource_online_archive.go +++ b/internal/service/onlinearchive/resource_online_archive.go @@ -633,8 +633,6 @@ func mapCriteria(d *schema.ResourceData) admin.Criteria { } func mapSchedule(d *schema.ResourceData) *admin.OnlineArchiveSchedule { - // scheduleInput := &matlas.OnlineArchiveSchedule{ - // We have to provide schedule.type="DEFAULT" when the schedule block is not provided or removed scheduleInput := &admin.OnlineArchiveSchedule{ Type: scheduleTypeDefault, diff --git a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go index 93be48622b..27c490da81 100644 --- a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go +++ b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go @@ -17,6 +17,7 @@ func TestAccPrivateEndpointRegionalMode_basic(t *testing.T) { } func TestAccPrivateEndpointRegionalMode_conn(t *testing.T) { + acc.SkipTestForCI(t) // needs AWS configuration var ( endpointResourceSuffix = "atlasple" resourceSuffix = "atlasrm" @@ -168,7 +169,7 @@ func checkExists(resourceName string) resource.TestCheckFunc { return fmt.Errorf("no ID is set") } projectID := rs.Primary.ID - _, _, err := acc.Conn().PrivateEndpoints.GetRegionalizedPrivateEndpointSetting(context.Background(), projectID) + _, _, err := acc.ConnV2().PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSetting(context.Background(), projectID).Execute() if err == nil { return nil } @@ -181,7 +182,7 @@ func checkDestroy(s *terraform.State) error { if rs.Type != "mongodbatlas_private_endpoint_regional_mode" { continue } - setting, _, _ := acc.Conn().PrivateEndpoints.GetRegionalizedPrivateEndpointSetting(context.Background(), rs.Primary.ID) + setting, _, _ := acc.ConnV2().PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSetting(context.Background(), rs.Primary.ID).Execute() if setting != nil && setting.Enabled != false { return fmt.Errorf("Regionalized private endpoint setting for project %q was not properly disabled", rs.Primary.ID) } diff --git a/internal/service/thirdpartyintegration/resource_third_party_integration_test.go b/internal/service/thirdpartyintegration/resource_third_party_integration_test.go index a4f9f78105..c73f0f534c 100644 --- a/internal/service/thirdpartyintegration/resource_third_party_integration_test.go +++ b/internal/service/thirdpartyintegration/resource_third_party_integration_test.go @@ -342,7 +342,7 @@ func checkDestroy(s *terraform.State) error { if attrs["type"] == "" { return fmt.Errorf("no type is set") } - _, _, err := acc.Conn().Integrations.Get(context.Background(), attrs["project_id"], attrs["type"]) + _, _, err := acc.ConnV2().ThirdPartyIntegrationsApi.GetThirdPartyIntegration(context.Background(), attrs["project_id"], attrs["type"]).Execute() if err == nil { return fmt.Errorf("third party integration service (%s) still exists", attrs["type"]) } @@ -496,7 +496,7 @@ func checkExists(resourceName string) resource.TestCheckFunc { if attrs["type"] == "" { return fmt.Errorf("no type is set") } - if _, _, err := acc.Conn().Integrations.Get(context.Background(), attrs["project_id"], attrs["type"]); err == nil { + if _, _, err := acc.ConnV2().ThirdPartyIntegrationsApi.GetThirdPartyIntegration(context.Background(), attrs["project_id"], attrs["type"]).Execute(); err == nil { return nil } return fmt.Errorf("third party integration (%s) does not exist", attrs["project_id"])