diff --git a/.github/workflows/run_release_code_and_api.yml b/.github/workflows/run_release_code_and_api.yml index 00dd687b1..5b79636a0 100644 --- a/.github/workflows/run_release_code_and_api.yml +++ b/.github/workflows/run_release_code_and_api.yml @@ -177,6 +177,7 @@ jobs: TRUSTSTORE_FILE: ${{ inputs.TRUSTSTORE_FILE }} VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }} DYNAMODB_AUTOSCALE: ${{ inputs.DYNAMODB_AUTOSCALE }} + DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: ${{ inputs.DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE }} run: ./release_code.sh - name: Deploy PSU API diff --git a/Makefile b/Makefile index 7f921c1ec..638b3d7c5 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,8 @@ sam-deploy-package: guard-artifact_bucket guard-artifact_bucket_prefix guard-sta CommitId=$$COMMIT_ID \ LogLevel=$$LOG_LEVEL \ LogRetentionInDays=$$LOG_RETENTION_DAYS \ - Env=$$TARGET_ENVIRONMENT + Env=$$TARGET_ENVIRONMENT \ + DeployCheckPrescriptionStatusUpdate=$$DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE compile-node: npx tsc --build tsconfig.build.json diff --git a/SAMtemplates/apis/main.yaml b/SAMtemplates/apis/main.yaml index 0b9690bb4..f26907dd3 100644 --- a/SAMtemplates/apis/main.yaml +++ b/SAMtemplates/apis/main.yaml @@ -60,10 +60,16 @@ Parameters: EnableSplunk: Type: String + DeployCheckPrescriptionStatusUpdate: + Type: String + Conditions: ShouldUseMutualTLS: !Equals - true - !Ref EnableMutualTLS + ShouldDeployCheckPrescriptionStatusUpdate: !Equals + - true + - !Ref DeployCheckPrescriptionStatusUpdate Resources: GenerateCertificate: @@ -462,6 +468,7 @@ Resources: Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CapabilityStatementFunctionArn}/invocations CheckPrescriptionStatusUpdatesResource: + Condition: ShouldDeployCheckPrescriptionStatusUpdate Type: AWS::ApiGateway::Resource Properties: RestApiId: !Ref RestApiGateway @@ -469,6 +476,7 @@ Resources: PathPart: checkprescriptionstatusupdates CheckPrescriptionStatusUpdatesMethod: + Condition: ShouldDeployCheckPrescriptionStatusUpdate Type: AWS::ApiGateway::Method Properties: RestApiId: !Ref RestApiGateway @@ -493,7 +501,10 @@ Resources: - StatusLambdaMethod - CapabilityStatementMethod - Format1UpdatePrescriptionStatusMethod - - CheckPrescriptionStatusUpdatesMethod + - !If + - ShouldDeployCheckPrescriptionStatusUpdate + - CheckPrescriptionStatusUpdatesMethod + - !Ref AWS::NoValue # see note above if you add something in here when you add a new endpoint Properties: RestApiId: !Ref RestApiGateway @@ -527,7 +538,11 @@ Resources: - Fn::ImportValue: !Sub ${StackName}:functions:${StatusFunctionName}:ExecuteLambdaPolicyArn - Fn::ImportValue: !Sub ${StackName}:functions:${CapabilityStatementFunctionName}:ExecuteLambdaPolicyArn - Fn::ImportValue: !Sub ${StackName}:state-machines:${Format1UpdatePrescriptionsStatusStateMachineName}:ExecuteStateMachinePolicy - - Fn::ImportValue: !Sub ${StackName}:functions:${CheckPrescriptionStatusUpdatesFunctionName}:ExecuteLambdaPolicyArn + - !If + - ShouldDeployCheckPrescriptionStatusUpdate + - Fn::ImportValue: !Sub ${StackName}:functions:${CheckPrescriptionStatusUpdatesFunctionName}:ExecuteLambdaPolicyArn + - !Ref AWS::NoValue + ApiName: !Sub ${StackName}-apigw LogRetentionInDays: !Ref LogRetentionInDays EnableSplunk: !Ref EnableSplunk diff --git a/SAMtemplates/functions/main.yaml b/SAMtemplates/functions/main.yaml index 686af00e9..0d9fe8d0c 100644 --- a/SAMtemplates/functions/main.yaml +++ b/SAMtemplates/functions/main.yaml @@ -40,6 +40,14 @@ Parameters: CommitId: Type: String + DeployCheckPrescriptionStatusUpdate: + Type: String + +Conditions: + ShouldDeployCheckPrescriptionStatusUpdate: !Equals + - true + - !Ref DeployCheckPrescriptionStatusUpdate + Resources: UpdatePrescriptionStatus: Type: AWS::Serverless::Function @@ -230,6 +238,7 @@ Resources: SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream CheckPrescriptionStatusUpdates: + Condition: ShouldDeployCheckPrescriptionStatusUpdate Type: AWS::Serverless::Function Properties: FunctionName: !Sub ${StackName}-CheckPrescriptionStatusUpdates @@ -251,6 +260,7 @@ Resources: - checkPrescriptionStatusUpdates/src/checkPrescriptionStatusUpdates.ts CheckPrescriptionStatusUpdatesResources: + Condition: ShouldDeployCheckPrescriptionStatusUpdate Type: AWS::Serverless::Application Properties: Location: lambda_resources.yaml @@ -315,8 +325,14 @@ Outputs: CheckPrescriptionStatusUpdatesFunctionName: Description: The function name of the CheckPrescriptionStatusUpdates lambda - Value: !Ref CheckPrescriptionStatusUpdates + Value: !If + - ShouldDeployCheckPrescriptionStatusUpdate + - !Ref CheckPrescriptionStatusUpdates + - !Ref AWS::NoValue CheckPrescriptionStatusUpdatesFunctionArn: Description: The function ARN of the CheckPrescriptionStatusUpdates lambda - Value: !GetAtt CheckPrescriptionStatusUpdates.Arn + Value: !If + - ShouldDeployCheckPrescriptionStatusUpdate + - !GetAtt CheckPrescriptionStatusUpdates.Arn + - !Ref AWS::NoValue diff --git a/SAMtemplates/main_template.yaml b/SAMtemplates/main_template.yaml index 2af9d97b3..23640d9c3 100644 --- a/SAMtemplates/main_template.yaml +++ b/SAMtemplates/main_template.yaml @@ -68,6 +68,9 @@ Parameters: Type: String Default: "xxx" + DeployCheckPrescriptionStatusUpdate: + Type: String + Resources: Tables: Type: AWS::Serverless::Application @@ -97,6 +100,7 @@ Resources: CheckPrescriptionStatusUpdatesFunctionArn: !GetAtt Functions.Outputs.CheckPrescriptionStatusUpdatesFunctionArn LogRetentionInDays: !Ref LogRetentionInDays EnableSplunk: !Ref EnableSplunk + DeployCheckPrescriptionStatusUpdate: !Ref DeployCheckPrescriptionStatusUpdate Functions: Type: AWS::Serverless::Application @@ -110,6 +114,7 @@ Resources: EnableSplunk: !Ref EnableSplunk VersionNumber: !Ref VersionNumber CommitId: !Ref CommitId + DeployCheckPrescriptionStatusUpdate: !Ref DeployCheckPrescriptionStatusUpdate StateMachines: Type: AWS::Serverless::Application