Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PN-10048: added condition, queue, policy and rules for cucumber test #488

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions scripts/aws/cfn/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Parameters:

Conditions:
IsDevEnv: !Equals [ !Ref EnvType, 'dev']
HasCucumberTest: !Or
- !Condition IsDevEnv
- !Equals ["test", !Ref "EnvType"]
- !Equals ["uat", !Ref "EnvType"]
- !Equals ["hotfix", !Ref "EnvType"]

Resources:
PCKmsEncDecDynamoDataKey:
Expand Down Expand Up @@ -496,6 +501,115 @@ Resources:
OncallDLQLimit: '1'
AlarmSNSTopicName: !Ref AlarmSNSTopicName

###### Cucumber Test Queue ######

PnEcQueueCucumberTestStack:
Type: AWS::CloudFormation::Stack
Condition: HasCucumberTest
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Properties:
TemplateURL: !Sub '${TemplateBucketBaseUrl}/fragments/sqs-queue.yaml'
Parameters:
QueueName: 'pn-ec-cucumber-test-queue'
SqsManagedSseEnabled: true
HasDLQ: 'true'
MaxReceiveCount: 10
QueueHasAlarm: 'false'
AlarmSNSTopicName: !Ref AlarmSNSTopicName
DelaySeconds: 1
VisibilityTimeout: 1

PnEcQueuePolicyCucumberTest:
Type: AWS::SQS::QueuePolicy
Condition: HasCucumberTest
Properties:
Queues:
- !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueURL
PolicyDocument:
Statement:
- Sid: 'AllowAccessSameAccount'
Action:
- 'sqs:*'
Effect: 'Allow'
Resource: !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueARN
Principal:
AWS: !Ref AWS::AccountId
- Sid: 'AllowPutEventsFromEventRule'
Action:
- 'sqs:SendMessage'
Effect: 'Allow'
Resource: !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueARN
Principal:
Service:
- 'events.amazonaws.com'
Condition:
ArnEquals:
aws:SourceArn: !GetAtt PnEcEventRuleCucumberTest.Arn

PnEcEventRuleCucumberTestDigitalCourtesy:
Type: AWS::Events::Rule
Condition: HasCucumberTest
Properties:
Description: 'This Event rule is used to forward Cucumber digitalCourtesy test events to the queue PnEcQueueCucumberTestStack'
EventBusName: !Ref PnEcEventBusTrackerExternalNotification
EventPattern:
source:
- 'NOTIFICATION TRACKER'
account:
- !Ref AWS::AccountId
region:
- !Ref AWS::Region
detail:
digitalCourtesy:
- prefix: 'PnEcMsCucumberTest'
State: 'ENABLED'
Targets:
- Arn: !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueARN
Id: 'PnEcCucumberTestQueueTargetdigitalCourtesy'

PnEcEventRuleCucumberTestDigitalLegal:
Type: AWS::Events::Rule
Condition: HasCucumberTest
Properties:
Description: 'This Event rule is used to forward Cucumber digitalLegal test events to the queue PnEcQueueCucumberTestStack'
EventBusName: !Ref PnEcEventBusTrackerExternalNotification
EventPattern:
source:
- 'NOTIFICATION TRACKER'
account:
- !Ref AWS::AccountId
region:
- !Ref AWS::Region
detail:
digitalLegal:
- prefix: 'PnEcMsCucumberTest'
State: 'ENABLED'
Targets:
- Arn: !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueARN
Id: 'PnEcCucumberTestQueueTargetDigitalLegal'

PnEcEventRuleCucumberTestAnalogMail:
Type: AWS::Events::Rule
Condition: HasCucumberTest
Properties:
Description: 'This Event rule is used to forward Cucumber analogMail test events to the queue PnEcQueueCucumberTestStack'
EventBusName: !Ref PnEcEventBusTrackerExternalNotification
EventPattern:
source:
- 'NOTIFICATION TRACKER'
account:
- !Ref AWS::AccountId
region:
- !Ref AWS::Region
detail:
analogMail:
- prefix: 'PnEcMsCucumberTest'
State: 'ENABLED'
Targets:
- Arn: !GetAtt PnEcQueueCucumberTestStack.Outputs.QueueARN
Id: 'PnEcCucumberTestQueueTargetAnalogMail'

###### CHANNEL : SMS #######

PnEcQueueBatchSMSStack:
Expand Down
Loading