File tree Expand file tree Collapse file tree
test/unit/lib/plugins/aws/package/compile/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1625,9 +1625,10 @@ class AwsProvider {
16251625 return customRole [ 'Fn::GetAtt' ] [ 0 ] ;
16261626 }
16271627 if (
1628- // otherwise, check if we have an import or parameters ref
1628+ // otherwise, check if we have an import, parameters ref or sub
16291629 customRole [ 'Fn::ImportValue' ] ||
1630- customRole . Ref
1630+ customRole . Ref ||
1631+ customRole [ 'Fn::Sub' ]
16311632 ) {
16321633 return null ;
16331634 }
Original file line number Diff line number Diff line change @@ -643,4 +643,36 @@ describe('AwsCompileSQSEvents #2', () => {
643643 expect ( eventSourceMappingResource . Properties . MaximumBatchingWindowInSeconds ) . to . equal ( 100 ) ;
644644 } ) ;
645645 } ) ;
646+
647+ it ( 'should not depend on default IAM role when custom role defined' , async ( ) => {
648+ const { awsNaming, cfTemplate } = await runServerless ( {
649+ fixture : 'function' ,
650+ configExt : {
651+ provider : {
652+ iam : {
653+ role : {
654+ 'Fn::Sub' : 'arn:aws:iam::${AWS::AccountId}:role/iam-role-name' ,
655+ } ,
656+ } ,
657+ } ,
658+ functions : {
659+ foo : {
660+ events : [
661+ {
662+ sqs : {
663+ arn : 'arn:aws:sqs:region:account:MyQueue' ,
664+ } ,
665+ } ,
666+ ] ,
667+ } ,
668+ } ,
669+ } ,
670+ command : 'package' ,
671+ } ) ;
672+
673+ const queueLogicalId = awsNaming . getQueueLogicalId ( 'foo' , 'MyQueue' ) ;
674+ const eventSourceMappingResource = cfTemplate . Resources [ queueLogicalId ] ;
675+
676+ expect ( eventSourceMappingResource . DependsOn ) . to . deep . equal ( [ ] ) ;
677+ } ) ;
646678} ) ;
You can’t perform that action at this time.
0 commit comments