Skip to content

Commit 799e95f

Browse files
INTMDB-919: resource_mongodbatlas_cloud_backup_snapshot_restore_job: Extend guards for delivery type deletions (#1300)
1 parent b4f6833 commit 799e95f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mongodbatlas/resource_mongodbatlas_cloud_backup_snapshot_restore_job.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func resourceMongoDBAtlasCloudBackupSnapshotRestoreJobDelete(ctx context.Context
309309

310310
shouldDelete := true
311311

312-
// Validate because atomated restore can not be cancelled
312+
// Validate because automated restore can not be cancelled
313313
if aut, _ := d.Get("delivery_type.automated").(string); aut == "true" {
314314
log.Print("Automated restore cannot be cancelled")
315315
shouldDelete = false
@@ -320,6 +320,11 @@ func resourceMongoDBAtlasCloudBackupSnapshotRestoreJobDelete(ctx context.Context
320320
shouldDelete = false
321321
}
322322

323+
if aut, ok := d.Get("delivery_type_config.0.point_in_time").(bool); ok && aut {
324+
log.Print("Point in time restore cannot be cancelled")
325+
shouldDelete = false
326+
}
327+
323328
if shouldDelete {
324329
_, err := conn.CloudProviderSnapshotRestoreJobs.Delete(context.Background(), requestParameters)
325330
if err != nil {

website/docs/r/cloud_backup_snapshot_restore_job.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ description: |-
1717

1818
-> **Important:** If you specify `deliveryType` : `automated` or `deliveryType` : `pointInTime` in your request body to create an automated restore job, Atlas removes all existing data on the target cluster prior to the restore.
1919

20+
-> **Important:** If you specify `deliveryType` : `automated` or `deliveryType` : `pointInTime` in your
21+
`mongodbatlas_cloud_backup_snapshot_restore_job` resource, you won't be able to delete the snapshot resource in MongoDB Atlas as the Atlas Admin API doesn't support this. The provider will remove the Terraform resource from the state file but won't destroy the MongoDB Atlas resource.
22+
2023
-> **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation.
2124

2225
-> **API Key Access List**: This resource requires an Atlas API Access Key List to utilize this feature. This means to manage this resources you must have the IP address or CIDR block that the Terraform connection is coming from added to the Atlas API Key Access List of the Atlas API key you are using. See [Resources that require API Key List](https://www.mongodb.com/docs/atlas/configure-api-access/#use-api-resources-that-require-an-access-list) for details.

0 commit comments

Comments
 (0)