diff --git a/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.story.tsx b/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.story.tsx
index be26aef7b78ba..92698e3b1871c 100644
--- a/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.story.tsx
+++ b/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.story.tsx
@@ -55,7 +55,11 @@ export const AllowSkipOnTimeout = () => (
export const AllowOverwrite = () => (
);
diff --git a/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.tsx b/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.tsx
index 3eea195d8c083..c5de2390ff7e2 100644
--- a/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.tsx
+++ b/web/packages/teleport/src/Discover/Database/CreateDatabase/CreateDatabaseDialog.tsx
@@ -63,7 +63,10 @@ export function CreateDatabaseDialog({
* Most likely cause of timeout is when we found a matching db_service
* but no db_server heartbeats. Most likely cause is because db_service
* has been stopped but is not removed from teleport yet (there is some
- * minutes delay on expiry)
+ * minutes delay on expiry).
+ *
+ * We allow the user to proceed to the next step to re-deploy (replace)
+ * the db_service that has been stopped.
*/
if (attempt.statusText === timeoutErrorMsg) {
content = ;
diff --git a/web/packages/teleport/src/Discover/Database/CreateDatabase/useCreateDatabase.ts b/web/packages/teleport/src/Discover/Database/CreateDatabase/useCreateDatabase.ts
index 45e9f7a33b9e0..a9ac3e6499c11 100644
--- a/web/packages/teleport/src/Discover/Database/CreateDatabase/useCreateDatabase.ts
+++ b/web/packages/teleport/src/Discover/Database/CreateDatabase/useCreateDatabase.ts
@@ -200,9 +200,9 @@ export function useCreateDatabase() {
if (overwriteDb) {
try {
- await ctx.databaseService.updateDatabase(clusterId, {
- kind: 'overwrite-update',
- dbOverwrite: db,
+ await ctx.databaseService.createDatabase(clusterId, {
+ ...db,
+ overwrite: true,
});
setCreatedDb(db);
} catch (err) {
@@ -232,7 +232,6 @@ export function useCreateDatabase() {
else if (requiresDbUpdate(db)) {
try {
await ctx.databaseService.updateDatabase(clusterId, {
- kind: 'partial-update',
...db,
});
setCreatedDb(db);
diff --git a/web/packages/teleport/src/Discover/Database/MutualTls/useMutualTls.ts b/web/packages/teleport/src/Discover/Database/MutualTls/useMutualTls.ts
index 868b745733e5a..6aa6bcc2631cd 100644
--- a/web/packages/teleport/src/Discover/Database/MutualTls/useMutualTls.ts
+++ b/web/packages/teleport/src/Discover/Database/MutualTls/useMutualTls.ts
@@ -78,7 +78,6 @@ export function useMutualTls({ ctx, props }: Props) {
run(() =>
ctx.databaseService
.updateDatabase(clusterId, {
- kind: 'partial-update',
name: meta.db.name,
caCert,
})
diff --git a/web/packages/teleport/src/services/databases/databases.ts b/web/packages/teleport/src/services/databases/databases.ts
index 9b5c4ca2d1255..4fa028a5b2f5f 100644
--- a/web/packages/teleport/src/services/databases/databases.ts
+++ b/web/packages/teleport/src/services/databases/databases.ts
@@ -77,13 +77,7 @@ class DatabaseService {
req: UpdateDatabaseRequest
): Promise {
return api
- .put(
- cfg.getDatabaseUrl(
- clusterId,
- req.kind === 'overwrite-update' ? req.dbOverwrite?.name : req.name
- ),
- req
- )
+ .put(cfg.getDatabaseUrl(clusterId, req.name), req)
.then(makeDatabase);
}
diff --git a/web/packages/teleport/src/services/databases/types.ts b/web/packages/teleport/src/services/databases/types.ts
index fc7bafeee34d0..6630646f9e4e4 100644
--- a/web/packages/teleport/src/services/databases/types.ts
+++ b/web/packages/teleport/src/services/databases/types.ts
@@ -56,12 +56,12 @@ export type DatabasesResponse = {
totalCount?: number;
};
-export type UpdateDatabaseRequest =
- | (Omit, 'protocol'> & {
- kind: 'partial-update';
- caCert?: string;
- })
- | { kind: 'overwrite-update'; dbOverwrite: CreateDatabaseRequest };
+export type UpdateDatabaseRequest = Omit<
+ Partial,
+ 'protocol'
+> & {
+ caCert?: string;
+};
export type CreateDatabaseRequest = {
name: string;
@@ -71,6 +71,7 @@ export type CreateDatabaseRequest = {
awsRds?: AwsRdsDatabase;
awsRegion?: Regions;
awsVpcId?: string;
+ overwrite?: boolean;
};
export type DatabaseIamPolicyResponse = {