diff --git a/src/lambda-db-password-rotation/index.js b/src/lambda-db-password-rotation/index.js index 2e2e45cb4..8a7658ad5 100644 --- a/src/lambda-db-password-rotation/index.js +++ b/src/lambda-db-password-rotation/index.js @@ -32,6 +32,7 @@ async function restartMainDbECSServices(ecsClient = new ECSClient(), overridenDe await dependencies.restartECSService(ecsClient, process.env.CMS_ADMIN_ECS_SERVICE_NAME) await dependencies.restartECSService(ecsClient, process.env.PRIVATE_API_ECS_SERVICE_NAME) await dependencies.restartECSService(ecsClient, process.env.PUBLIC_API_ECS_SERVICE_NAME) + await dependencies.restartECSService(ecsClient, process.env.FEEDBACK_API_ECS_SERVICE_NAME) console.log(`All required ECS tasks have been restarted for main DB`); }; diff --git a/src/lambda-db-password-rotation/index.test.js b/src/lambda-db-password-rotation/index.test.js index 5284d9245..d54749f3b 100644 --- a/src/lambda-db-password-rotation/index.test.js +++ b/src/lambda-db-password-rotation/index.test.js @@ -58,12 +58,14 @@ describe('restartMainDbECSServices', () => { const fakeCMSAdminECSServiceName = 'fake-cms-admin-ecs-service-name' const fakePrivateAPIECSServiceName = 'fake-private-api-ecs-service-name' const fakePublicAPIECSServiceName = 'fake-public-api-ecs-service-name' + const fakeFeedbackAPIECSServiceName = 'fake-feedback-api-ecs-service-name' const mockedEnvVar = sinon.stub(process, 'env').value( { CMS_ADMIN_ECS_SERVICE_NAME: fakeCMSAdminECSServiceName, PRIVATE_API_ECS_SERVICE_NAME: fakePrivateAPIECSServiceName, PUBLIC_API_ECS_SERVICE_NAME: fakePublicAPIECSServiceName, + FEEDBACK_API_ECS_SERVICE_NAME: fakeFeedbackAPIECSServiceName, } ); @@ -78,12 +80,11 @@ describe('restartMainDbECSServices', () => { await restartMainDbECSServices(mockedECSClient, spyDependencies); // Then - // The function should have been called 3 times, 1 for each ECS service - expect(restartECSServiceSpy.calledThrice).toBeTruthy(); // The function should have been called with each ECS service name expect(restartECSServiceSpy.firstCall.lastArg).toEqual(fakeCMSAdminECSServiceName) expect(restartECSServiceSpy.secondCall.lastArg).toEqual(fakePrivateAPIECSServiceName) expect(restartECSServiceSpy.thirdCall.lastArg).toEqual(fakePublicAPIECSServiceName) + expect(restartECSServiceSpy.lastCall.lastArg).toEqual(fakeFeedbackAPIECSServiceName) // Restore the environment variable mockedEnvVar.restore(); diff --git a/terraform/20-app/lambda.db-password-rotation.tf b/terraform/20-app/lambda.db-password-rotation.tf index 7a67c35cf..555b04255 100644 --- a/terraform/20-app/lambda.db-password-rotation.tf +++ b/terraform/20-app/lambda.db-password-rotation.tf @@ -19,6 +19,7 @@ module "lambda_db_password_rotation" { CMS_ADMIN_ECS_SERVICE_NAME = module.ecs_service_cms_admin.name PRIVATE_API_ECS_SERVICE_NAME = module.ecs_service_private_api.name PUBLIC_API_ECS_SERVICE_NAME = module.ecs_service_public_api.name + FEEDBACK_API_ECS_SERVICE_NAME = module.ecs_service_feedback_api.name FEATURE_FLAGS_ECS_SERVICE_NAME = module.ecs_service_feature_flags.name } @@ -31,7 +32,9 @@ module "lambda_db_password_rotation" { module.ecs_service_private_api.id, module.ecs_service_public_api.id, module.ecs_service_cms_admin.id, + module.ecs_service_feedback_api.id, module.ecs_service_feature_flags.id, + ] } }