File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed
lib/deploy/events/apiGateway Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,13 @@ module.exports = {
4343 } ,
4444 } ) ;
4545
46- if ( ! _ . isEmpty ( this . serverless . service . provider . resourcePolicy ) ) {
46+ const resourcePolicy = _ . get ( this . serverless . service . provider . apiGateway , 'resourcePolicy' )
47+ || this . serverless . service . provider . resourcePolicy ;
48+
49+ if ( ! _ . isEmpty ( resourcePolicy ) ) {
4750 const policy = {
4851 Version : '2012-10-17' ,
49- Statement : this . serverless . service . provider . resourcePolicy ,
52+ Statement : resourcePolicy ,
5053 } ;
5154 _ . merge ( this . serverless . service . provider . compiledCloudFormationTemplate
5255 . Resources [ this . apiGatewayRestApiLogicalId ] . Properties , {
Original file line number Diff line number Diff line change @@ -89,19 +89,21 @@ describe('#compileRestApi()', () => {
8989 } ) ) ;
9090
9191 it ( 'should create a REST API resource with resource policy' , ( ) => {
92- serverlessStepFunctions . serverless . service . provider . resourcePolicy = [
93- {
94- Effect : 'Allow' ,
95- Principal : '*' ,
96- Action : 'execute-api:Invoke' ,
97- Resource : [ 'execute-api:/*/*/*' ] ,
98- Condition : {
99- IpAddress : {
100- 'aws:SourceIp' : [ '123.123.123.123' ] ,
92+ serverlessStepFunctions . serverless . service . provider . apiGateway = {
93+ resourcePolicy : [
94+ {
95+ Effect : 'Allow' ,
96+ Principal : '*' ,
97+ Action : 'execute-api:Invoke' ,
98+ Resource : [ 'execute-api:/*/*/*' ] ,
99+ Condition : {
100+ IpAddress : {
101+ 'aws:SourceIp' : [ '123.123.123.123' ] ,
102+ } ,
101103 } ,
102104 } ,
103- } ,
104- ] ;
105+ ] ,
106+ } ;
105107 return serverlessStepFunctions . compileRestApi ( ) . then ( ( ) => {
106108 expect ( serverlessStepFunctions . serverless . service . provider
107109 . compiledCloudFormationTemplate . Resources ) . to . deep . equal (
You can’t perform that action at this time.
0 commit comments