Skip to content

Commit ca46d20

Browse files
authored
feat: Remove serverless references from existing resources (#1603)
1 parent 42b217c commit ca46d20

18 files changed

Lines changed: 96 additions & 185 deletions

File tree

cfn-resources/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ Note these are also hosted on AWS CloudFormation Public Registry under Third Par
3737
| project-invitation | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/project-invitation/project-invitation.json) | [./project-invitation/test](./project-invitation/test) |
3838
| project-ip-access-list | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/project-ip-access-list/ip-access-list.yaml) | [./project-ip-access-list/test](./project-ip-access-list/test) |
3939
| search-index | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/search-index/searchIndex.json) | [./search-indexes/test](./search-indexes/test) |
40-
| serverless-instance | ![Build](https://img.shields.io/badge/Deprecated-red) | [example](../examples/serverless-instance/serverless-instance.json) | [./serverless-instance/test](./serverless-instance/test) |
4140
| teams | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/teams/teams.json) | [./teams/test](./teams/test) |
4241
| third-party-integration | ![Build](https://img.shields.io/badge/GA-green) | [example files](../examples/thirdpartyintegrations) | [./third-party-integration/test](./third-party-integration/test) |
4342
| trigger | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/trigger/trigger.json) | [./trigger/test](./trigger/test) |
4443
| X509AuthenticationDatabaseUser | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/x509-authentication-db-user/x509-authentication-db-user.json) | [./x509-authentication-database-user/test](./x509-authentication-database-user/test) |
4544
| federated-database-instance | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/federated-database-instance/federatedDatabaseInstance.json) | [./federated-database-instance/test](./federated-database-instance/test) |
4645
| privatelink-endpoint-service-data-federation-online-archive | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/privatelink-endpoint-service-data-federation-online-archive/privatelink-endpoint-service-data-federation-online-archive.json) | [./privatelink-endpoint-service-data-federation-online-archive/test](./privatelink-endpoint-service-data-federation-online-archive/test) |
4746
| federated-query-limit | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/federated-query-limit/federatedQueryLimit.json) | [./federated-query-limit/test](./federated-query-limit/test) |
48-
| serverless-private-endpoint | ![Build](https://img.shields.io/badge/Deprecated-red) | [example](../examples/serverless-private-endpoint/serverless-private-endpoint-with-aws-private-endpoint.json) | [./serverless-private-endpoint/test](./serverless-private-endpoint/test) |
4947
| api-key | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/api-key/api-key.json) | [./api-key/test](./api-key/test) |
5048
| access-list-api-key | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/access-list-api-key/access-list-api-key.json) | [./access-list-api-key/test](./access-list-api-key/test) |
5149
| organization | ![Build](https://img.shields.io/badge/GA-green) | [example](../examples/organization/organization.json) | [./organization/test](./organization/test) |

cfn-resources/cloud-backup-restore-jobs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## (2025-02-26)
4+
5+
**(BREAKING CHANGE) REMOVED SUPPORT FOR SERVERLESS INSTANCES**
6+
7+
Serverless instances are no longer supported. The `InstanceType` field now only accepts `"cluster"`. Serverless API calls and code paths have been removed.
8+
39
## (2023-10-17)
410

511
**(BREAKING CHANGE) FIELD CHANGES**

cfn-resources/cloud-backup-restore-jobs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
## Description
44
Resource for managing [Cloud BackUp Restore Jobs](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-cloud-backups).
55

6-
**WARNING:** `serverless` instance type is deprecated and will be removed in January 2026. For more details, see [Migrate your programmatic tools from M2, M5, or Serverless Instances to Flex Clusters](https://www.mongodb.com/docs/atlas/flex-migration/).
7-
86
## Requirements
97

108
Set up an AWS profile to securely give CloudFormation access to your Atlas credentials.

cfn-resources/cloud-backup-restore-jobs/cmd/resource/resource.go

Lines changed: 27 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const (
4141
defaultTimeOutInSeconds = 1200
4242
defaultReturnSuccessIfTimeOut = false
4343
clusterInstanceType = "cluster"
44-
serverlessInstanceType = "serverless"
4544
)
4645

4746
func setup() {
@@ -53,8 +52,8 @@ func validateModel(fields []string, model *Model) *handler.ProgressEvent {
5352
return pe
5453
}
5554

56-
if *model.InstanceType != clusterInstanceType && *model.InstanceType != serverlessInstanceType {
57-
pe := progressevent.GetFailedEventByCode(fmt.Sprintf("InstanceType must be %s or %s", clusterInstanceType, serverlessInstanceType),
55+
if *model.InstanceType != clusterInstanceType {
56+
pe := progressevent.GetFailedEventByCode(fmt.Sprintf("InstanceType must be %s", clusterInstanceType),
5857
string(types.HandlerErrorCodeInvalidRequest))
5958
return &pe
6059
}
@@ -96,21 +95,12 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
9695
}
9796
}
9897

99-
if *currentModel.InstanceType == serverlessInstanceType {
100-
params := paramsServerless(currentModel)
101-
serverless, resp, err := client.Atlas20231115014.CloudBackupsApi.CreateServerlessBackupRestoreJob(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName, params).Execute()
102-
if err != nil {
103-
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
104-
}
105-
currentModel.Id = serverless.Id
106-
} else {
107-
params := paramsServer(currentModel)
108-
server, resp, err := client.Atlas20231115014.CloudBackupsApi.CreateBackupRestoreJob(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName, params).Execute()
109-
if err != nil {
110-
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
111-
}
112-
currentModel.Id = server.Id
98+
params := paramsServer(currentModel)
99+
server, resp, err := client.Atlas20231115014.CloudBackupsApi.CreateBackupRestoreJob(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName, params).Execute()
100+
if err != nil {
101+
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
113102
}
103+
currentModel.Id = server.Id
114104

115105
if aws.ToBool(currentModel.EnableSynchronousCreation) {
116106
return progressevent.GetInProgressProgressEvent(
@@ -229,45 +219,22 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
229219
}
230220

231221
models := make([]interface{}, 0)
232-
if *currentModel.InstanceType == serverlessInstanceType {
233-
serverless, resp, err := client.Atlas20231115014.CloudBackupsApi.ListServerlessBackupRestoreJobs(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName).Execute()
234-
if err != nil {
235-
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
236-
}
237-
instanceType := serverlessInstanceType
238-
results := serverless.GetResults()
239-
for i := range results {
240-
job := &results[i]
241-
model := &Model{
242-
ProjectId: currentModel.ProjectId,
243-
InstanceType: &instanceType,
244-
InstanceName: currentModel.InstanceName,
245-
Profile: currentModel.Profile,
246-
}
247-
if !aws.ToBool(job.Cancelled) && !aws.ToBool(job.Expired) {
248-
updateModelServerless(model, job)
249-
models = append(models, model)
250-
}
251-
}
252-
} else {
253-
server, resp, err := client.Atlas20231115014.CloudBackupsApi.ListBackupRestoreJobs(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName).Execute()
254-
if err != nil {
255-
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
222+
server, resp, err := client.Atlas20231115014.CloudBackupsApi.ListBackupRestoreJobs(context.Background(), *currentModel.ProjectId, *currentModel.InstanceName).Execute()
223+
if err != nil {
224+
return progressevent.GetFailedEventByResponse(err.Error(), resp), nil
225+
}
226+
results := server.GetResults()
227+
for i := range results {
228+
job := &results[i]
229+
model := &Model{
230+
ProjectId: currentModel.ProjectId,
231+
InstanceType: currentModel.InstanceType,
232+
InstanceName: currentModel.InstanceName,
233+
Profile: currentModel.Profile,
256234
}
257-
instanceType := clusterInstanceType
258-
results := server.GetResults()
259-
for i := range results {
260-
job := &results[i]
261-
model := &Model{
262-
ProjectId: currentModel.ProjectId,
263-
InstanceType: &instanceType,
264-
InstanceName: currentModel.InstanceName,
265-
Profile: currentModel.Profile,
266-
}
267-
if !aws.ToBool(job.Cancelled) && !aws.ToBool(job.Expired) {
268-
updateModelServer(model, job)
269-
models = append(models, model)
270-
}
235+
if !aws.ToBool(job.Cancelled) && !aws.ToBool(job.Expired) {
236+
updateModelServer(model, job)
237+
models = append(models, model)
271238
}
272239
}
273240

@@ -354,39 +321,15 @@ func isTimeOutReached(startTime string, timeOutInSeconds int) bool {
354321
}
355322

356323
func updateModel(client *util.MongoDBClient, model *Model, checkFinish bool) *handler.ProgressEvent {
357-
if *model.InstanceType == serverlessInstanceType {
358-
serverless, resp, err := client.Atlas20231115014.CloudBackupsApi.GetServerlessBackupRestoreJob(context.Background(), *model.ProjectId, *model.InstanceName, *model.Id).Execute()
359-
if err != nil {
360-
pe := progressevent.GetFailedEventByResponse(err.Error(), resp)
361-
return &pe
362-
}
363-
updateModelServerless(model, serverless)
364-
} else {
365-
server, resp, err := client.Atlas20231115014.CloudBackupsApi.GetBackupRestoreJob(context.Background(), *model.ProjectId, *model.InstanceName, *model.Id).Execute()
366-
if err != nil {
367-
pe := progressevent.GetFailedEventByResponse(err.Error(), resp)
368-
return &pe
369-
}
370-
updateModelServer(model, server)
324+
server, resp, err := client.Atlas20231115014.CloudBackupsApi.GetBackupRestoreJob(context.Background(), *model.ProjectId, *model.InstanceName, *model.Id).Execute()
325+
if err != nil {
326+
pe := progressevent.GetFailedEventByResponse(err.Error(), resp)
327+
return &pe
371328
}
329+
updateModelServer(model, server)
372330
return nil
373331
}
374332

375-
func updateModelServerless(model *Model, job *admin20231115014.ServerlessBackupRestoreJob) {
376-
model.TargetClusterName = &job.TargetClusterName
377-
model.DeliveryType = &job.DeliveryType
378-
model.ExpiresAt = util.TimePtrToStringPtr(job.ExpiresAt)
379-
model.Id = job.Id
380-
model.FinishedAt = util.TimePtrToStringPtr(job.FinishedAt)
381-
model.SnapshotId = job.SnapshotId
382-
model.TargetProjectId = &job.TargetGroupId
383-
model.Timestamp = util.TimePtrToStringPtr(job.Timestamp)
384-
model.Cancelled = job.Cancelled
385-
model.Expired = job.Expired
386-
model.DeliveryUrl = job.GetDeliveryUrl()
387-
model.Links = flattenLinks(job.GetLinks())
388-
}
389-
390333
func updateModelServer(model *Model, job *admin20231115014.DiskBackupSnapshotRestoreJob) {
391334
model.TargetClusterName = job.TargetClusterName
392335
model.DeliveryType = &job.DeliveryType
@@ -425,15 +368,3 @@ func paramsServer(model *Model) *admin20231115014.DiskBackupSnapshotRestoreJob {
425368
PointInTimeUTCSeconds: model.PointInTimeUtcSeconds,
426369
}
427370
}
428-
429-
func paramsServerless(model *Model) *admin20231115014.ServerlessBackupRestoreJob {
430-
return &admin20231115014.ServerlessBackupRestoreJob{
431-
SnapshotId: model.SnapshotId,
432-
DeliveryType: *model.DeliveryType,
433-
TargetClusterName: *model.TargetClusterName,
434-
TargetGroupId: *model.TargetProjectId,
435-
OplogTs: util.StrPtrToIntPtr(model.OpLogTs),
436-
OplogInc: util.StrPtrToIntPtr(model.OpLogInc),
437-
PointInTimeUTCSeconds: model.PointInTimeUtcSeconds,
438-
}
439-
}

cfn-resources/cloud-backup-restore-jobs/docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ _Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/l
6363

6464
#### InstanceType
6565

66-
Type of instance specified on the Instance Name serverless or cluster. **WARNING:** `serverless` instance type is deprecated and will be removed in January 2026. For more details, see [Migrate your programmatic tools from M2, M5, or Serverless Instances to Flex Clusters](https://www.mongodb.com/docs/atlas/flex-migration/).
66+
Type of instance specified on the Instance Name.
6767

6868
_Required_: Yes
6969

7070
_Type_: String
7171

72-
_Allowed Values_: <code>serverless</code> | <code>cluster</code>
72+
_Allowed Values_: <code>cluster</code>
7373

7474
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)
7575

7676
#### InstanceName
7777

78-
The instance name of the Serverless/Cluster whose snapshot you want to restore or you want to retrieve restore jobs.
78+
Human-readable label that identifies the cluster.
7979

8080
_Required_: Yes
8181

cfn-resources/cloud-backup-restore-jobs/mongodb-atlas-cloudbackuprestorejobs.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
"type": "string"
2929
},
3030
"InstanceType": {
31-
"description": "Type of instance specified on the Instance Name serverless or cluster. **WARNING:** `serverless` instance type is deprecated and will be removed in January 2026. For more details, see [Migrate your programmatic tools from M2, M5, or Serverless Instances to Flex Clusters](https://www.mongodb.com/docs/atlas/flex-migration/).",
31+
"description": "Type of instance specified on the Instance Name.",
3232
"type": "string",
3333
"enum": [
34-
"serverless",
3534
"cluster"
3635
]
3736
},
3837
"InstanceName": {
39-
"description": "The instance name of the Serverless/Cluster whose snapshot you want to restore or you want to retrieve restore jobs.",
38+
"description": "Human-readable label that identifies the cluster.",
4039
"type": "string"
4140
},
4241
"Id": {

cfn-resources/cloud-backup-snapshot/cmd/resource/config.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)