@@ -2479,6 +2479,313 @@ Object {
24792479}
24802480`;
24812481
2482+ exports[`Test Serverless SNS SQS Lambda when the provider is specified via a command line option when queue policy is disabled should not produce IAM queue policy in the CF template 1`] = `
2483+ Object {
2484+ " AWSTemplateFormatVersion" : " 2010-09-09" ,
2485+ " Description" : " The AWS CloudFormation template for this Serverless application" ,
2486+ " Outputs" : Object {
2487+ " ServerlessDeploymentBucketName" : Object {
2488+ " Export" : Object {
2489+ " Name" : " sls-test-service-dev-test-ServerlessDeploymentBucketName" ,
2490+ },
2491+ " Value" : Object {
2492+ " Ref" : " ServerlessDeploymentBucket" ,
2493+ },
2494+ },
2495+ " TestDashfunctionLambdaFunctionQualifiedArn" : Object {
2496+ " Description" : " Current Lambda function version" ,
2497+ " Export" : Object {
2498+ " Name" : " sls-test-service-dev-test-TestDashfunctionLambdaFunctionQualifiedArn" ,
2499+ },
2500+ " Value" : Object {
2501+ " Ref" : " TestDashfunctionLambdaVersionA6M23sE6AN9SgN5IQgI9bd1tqh7YgxtybZ9LOhkLY4" ,
2502+ },
2503+ },
2504+ },
2505+ " Resources" : Object {
2506+ " IamRoleLambdaExecution" : Object {
2507+ " Properties" : Object {
2508+ " AssumeRolePolicyDocument" : Object {
2509+ " Statement" : Array [
2510+ Object {
2511+ " Action" : Array [
2512+ " sts:AssumeRole" ,
2513+ ],
2514+ " Effect" : " Allow" ,
2515+ " Principal" : Object {
2516+ " Service" : Array [
2517+ " lambda.amazonaws.com" ,
2518+ ],
2519+ },
2520+ },
2521+ ],
2522+ " Version" : " 2012-10-17" ,
2523+ },
2524+ " Path" : " /" ,
2525+ " Policies" : Array [
2526+ Object {
2527+ " PolicyDocument" : Object {
2528+ " Statement" : Array [
2529+ Object {
2530+ " Action" : Array [
2531+ " logs:CreateLogStream" ,
2532+ " logs:CreateLogGroup" ,
2533+ ],
2534+ " Effect" : " Allow" ,
2535+ " Resource" : Array [
2536+ Object {
2537+ " Fn::Sub" : " arn:\$ {AWS::Partition}:logs:\$ {AWS::Region}:\$ {AWS::AccountId}:log-group:/aws/lambda/test-service-dev-test*:*" ,
2538+ },
2539+ ],
2540+ },
2541+ Object {
2542+ " Action" : Array [
2543+ " logs:PutLogEvents" ,
2544+ ],
2545+ " Effect" : " Allow" ,
2546+ " Resource" : Array [
2547+ Object {
2548+ " Fn::Sub" : " arn:\$ {AWS::Partition}:logs:\$ {AWS::Region}:\$ {AWS::AccountId}:log-group:/aws/lambda/test-service-dev-test*:*:*" ,
2549+ },
2550+ ],
2551+ },
2552+ ],
2553+ " Version" : " 2012-10-17" ,
2554+ },
2555+ " PolicyName" : Object {
2556+ " Fn::Join" : Array [
2557+ " -" ,
2558+ Array [
2559+ " test-service" ,
2560+ " dev-test" ,
2561+ " lambda" ,
2562+ ],
2563+ ],
2564+ },
2565+ },
2566+ ],
2567+ " RoleName" : Object {
2568+ " Fn::Join" : Array [
2569+ " -" ,
2570+ Array [
2571+ " test-service" ,
2572+ " dev-test" ,
2573+ Object {
2574+ " Ref" : " AWS::Region" ,
2575+ },
2576+ " lambdaRole" ,
2577+ ],
2578+ ],
2579+ },
2580+ },
2581+ " Type" : " AWS::IAM::Role" ,
2582+ },
2583+ " ServerlessDeploymentBucket" : Object {
2584+ " Properties" : Object {
2585+ " BucketEncryption" : Object {
2586+ " ServerSideEncryptionConfiguration" : Array [
2587+ Object {
2588+ " ServerSideEncryptionByDefault" : Object {
2589+ " SSEAlgorithm" : " AES256" ,
2590+ },
2591+ },
2592+ ],
2593+ },
2594+ },
2595+ " Type" : " AWS::S3::Bucket" ,
2596+ },
2597+ " ServerlessDeploymentBucketPolicy" : Object {
2598+ " Properties" : Object {
2599+ " Bucket" : Object {
2600+ " Ref" : " ServerlessDeploymentBucket" ,
2601+ },
2602+ " PolicyDocument" : Object {
2603+ " Statement" : Array [
2604+ Object {
2605+ " Action" : " s3:*" ,
2606+ " Condition" : Object {
2607+ " Bool" : Object {
2608+ " aws:SecureTransport" : false ,
2609+ },
2610+ },
2611+ " Effect" : " Deny" ,
2612+ " Principal" : " *" ,
2613+ " Resource" : Array [
2614+ Object {
2615+ " Fn::Join" : Array [
2616+ " " ,
2617+ Array [
2618+ " arn:" ,
2619+ Object {
2620+ " Ref" : " AWS::Partition" ,
2621+ },
2622+ " :s3:::" ,
2623+ Object {
2624+ " Ref" : " ServerlessDeploymentBucket" ,
2625+ },
2626+ " /*" ,
2627+ ],
2628+ ],
2629+ },
2630+ Object {
2631+ " Fn::Join" : Array [
2632+ " " ,
2633+ Array [
2634+ " arn:" ,
2635+ Object {
2636+ " Ref" : " AWS::Partition" ,
2637+ },
2638+ " :s3:::" ,
2639+ Object {
2640+ " Ref" : " ServerlessDeploymentBucket" ,
2641+ },
2642+ ],
2643+ ],
2644+ },
2645+ ],
2646+ },
2647+ ],
2648+ },
2649+ },
2650+ " Type" : " AWS::S3::BucketPolicy" ,
2651+ },
2652+ " Subscribesome-nameTopic" : Object {
2653+ " Properties" : Object {
2654+ " Endpoint" : Object {
2655+ " Fn::GetAtt" : Array [
2656+ " some-nameQueue" ,
2657+ " Arn" ,
2658+ ],
2659+ },
2660+ " Protocol" : " sqs" ,
2661+ " RawMessageDelivery" : false ,
2662+ " TopicArn" : " arn:aws:sns:us-east-2:123456789012:MyTopic" ,
2663+ },
2664+ " Type" : " AWS::SNS::Subscription" ,
2665+ },
2666+ " Test-functionEventSourceMappingSQSsome-nameQueue" : Object {
2667+ " Properties" : Object {
2668+ " BatchSize" : 10 ,
2669+ " Enabled" : " True" ,
2670+ " EventSourceArn" : Object {
2671+ " Fn::GetAtt" : Array [
2672+ " some-nameQueue" ,
2673+ " Arn" ,
2674+ ],
2675+ },
2676+ " FunctionName" : Object {
2677+ " Fn::GetAtt" : Array [
2678+ " Test-functionLambdaFunction" ,
2679+ " Arn" ,
2680+ ],
2681+ },
2682+ " MaximumBatchingWindowInSeconds" : 0 ,
2683+ },
2684+ " Type" : " AWS::Lambda::EventSourceMapping" ,
2685+ },
2686+ " TestDashfunctionLambdaFunction" : Object {
2687+ " DependsOn" : Array [
2688+ " TestDashfunctionLogGroup" ,
2689+ ],
2690+ " Properties" : Object {
2691+ " Code" : Object {
2692+ " S3Bucket" : Object {
2693+ " Ref" : " ServerlessDeploymentBucket" ,
2694+ },
2695+ " S3Key" : Any <String >,
2696+ },
2697+ "FunctionName": "test-service-dev-test-test-function",
2698+ "Handler": "handler.handler",
2699+ "MemorySize": 1024,
2700+ "Role": Object {
2701+ " Fn::GetAtt" : Array [
2702+ " IamRoleLambdaExecution" ,
2703+ " Arn" ,
2704+ ],
2705+ } ,
2706+ "Runtime": "nodejs14.x",
2707+ "Timeout": 6,
2708+ },
2709+ "Type": "AWS::Lambda::Function",
2710+ },
2711+ "TestDashfunctionLambdaVersionA6M23sE6AN9SgN5IQgI9bd1tqh7YgxtybZ9LOhkLY4": Object {
2712+ " DeletionPolicy" : " Retain" ,
2713+ " Properties" : Object {
2714+ " CodeSha256" : " gxQ2/ARVAXYSjz4OF5PnsOiOB+yUlXG8z5y5h6bNs7U=" ,
2715+ " FunctionName" : Object {
2716+ " Ref" : " TestDashfunctionLambdaFunction" ,
2717+ },
2718+ },
2719+ " Type" : " AWS::Lambda::Version" ,
2720+ } ,
2721+ "TestDashfunctionLogGroup": Object {
2722+ " Properties" : Object {
2723+ " LogGroupName" : " /aws/lambda/test-service-dev-test-test-function" ,
2724+ },
2725+ " Type" : " AWS::Logs::LogGroup" ,
2726+ } ,
2727+ "some-nameDeadLetterQueue": Object {
2728+ " Properties" : Object {
2729+ " QueueName" : " test-service-dev-test-Test-functionsome-nameDeadLetterQueue" ,
2730+ },
2731+ " Type" : " AWS::SQS::Queue" ,
2732+ } ,
2733+ "some-nameQueue": Object {
2734+ " Properties" : Object {
2735+ " QueueName" : " test-service-dev-test-Test-functionsome-nameQueue" ,
2736+ " RedrivePolicy" : Object {
2737+ " deadLetterTargetArn" : Object {
2738+ " Fn::GetAtt" : Array [
2739+ " some-nameDeadLetterQueue" ,
2740+ " Arn" ,
2741+ ],
2742+ },
2743+ " maxReceiveCount" : 5 ,
2744+ },
2745+ },
2746+ " Type" : " AWS::SQS::Queue" ,
2747+ } ,
2748+ "some-nameQueuePolicy": Object {
2749+ " Properties" : Object {
2750+ " PolicyDocument" : Object {
2751+ " Id" : " test-service-dev-test-Test-functionsome-nameQueue" ,
2752+ " Statement" : Array [
2753+ Object {
2754+ " Action" : " SQS:SendMessage" ,
2755+ " Condition" : Object {
2756+ " ArnEquals" : Object {
2757+ " aws:SourceArn" : Array [
2758+ " arn:aws:sns:us-east-2:123456789012:MyTopic" ,
2759+ ],
2760+ },
2761+ },
2762+ " Effect" : " Allow" ,
2763+ " Principal" : Object {
2764+ " Service" : " sns.amazonaws.com" ,
2765+ },
2766+ " Resource" : Object {
2767+ " Fn::GetAtt" : Array [
2768+ " some-nameQueue" ,
2769+ " Arn" ,
2770+ ],
2771+ },
2772+ " Sid" : " test-service-dev-test-Test-functionsome-nameSid" ,
2773+ },
2774+ ],
2775+ " Version" : " 2012-10-17" ,
2776+ },
2777+ " Queues" : Array [
2778+ Object {
2779+ " Ref" : " some-nameQueue" ,
2780+ },
2781+ ],
2782+ },
2783+ " Type" : " AWS::SQS::QueuePolicy" ,
2784+ } ,
2785+ },
2786+ }
2787+ `;
2788+
24822789exports[`Test Serverless SNS SQS Lambda when the provider is specified via a config option in serverless.yml when fifo is true should produce valid fifo queues 1`] = `
24832790Object {
24842791 " Resources" : Object {
0 commit comments