@@ -24,7 +24,6 @@ module.exports = {
2424 validateHandlerProperty ( funcObject , functionName ) ;
2525 validateEventsProperty ( funcObject , functionName ) ;
2626 validateVpcConnectorProperty ( funcObject , functionName ) ;
27- validateIamProperty ( funcObject , functionName ) ;
2827
2928 const funcTemplate = getFunctionTemplate (
3029 funcObject ,
@@ -52,11 +51,6 @@ module.exports = {
5251 _ . get ( this , 'serverless.service.provider.environment' ) ,
5352 funcObject . environment // eslint-disable-line comma-dangle
5453 ) ;
55- funcTemplate . accessControl . gcpIamPolicy . bindings = _ . unionBy (
56- _ . get ( funcObject , 'iam.bindings' ) ,
57- _ . get ( this , 'serverless.service.provider.iam.bindings' ) ,
58- 'role'
59- ) ;
6054
6155 if ( ! funcTemplate . properties . serviceAccountEmail ) {
6256 delete funcTemplate . properties . serviceAccountEmail ;
@@ -89,14 +83,6 @@ module.exports = {
8983
9084 funcTemplate . properties . httpsTrigger = { } ;
9185 funcTemplate . properties . httpsTrigger . url = url ;
92-
93- if ( funcObject . allowUnauthenticated ) {
94- funcTemplate . accessControl . gcpIamPolicy . bindings = _ . unionBy (
95- [ { role : 'roles/cloudfunctions.invoker' , members : [ 'allUsers' ] } ] ,
96- funcTemplate . accessControl . gcpIamPolicy . bindings ,
97- 'role'
98- ) ;
99- }
10086 }
10187 if ( eventType === 'event' ) {
10288 const type = funcObject . events [ 0 ] . event . eventType ;
@@ -109,10 +95,6 @@ module.exports = {
10995 funcTemplate . properties . eventTrigger . resource = resource ;
11096 }
11197
112- if ( ! funcTemplate . accessControl . gcpIamPolicy . bindings . length ) {
113- delete funcTemplate . accessControl ;
114- }
115-
11698 this . serverless . service . provider . compiledConfigurationTemplate . resources . push ( funcTemplate ) ;
11799 } ) ;
118100
@@ -175,29 +157,6 @@ const validateVpcConnectorProperty = (funcObject, functionName) => {
175157 }
176158} ;
177159
178- const validateIamProperty = ( funcObject , functionName ) => {
179- if ( _ . get ( funcObject , 'iam.bindings' ) && funcObject . iam . bindings . length > 0 ) {
180- funcObject . iam . bindings . forEach ( ( binding ) => {
181- if ( ! binding . role ) {
182- const errorMessage = [
183- `The function "${ functionName } " has no role specified for an IAM binding.` ,
184- ' Each binding requires a role. For details on supported roles, see the documentation' ,
185- ' at: https://cloud.google.com/iam/docs/understanding-roles' ,
186- ] . join ( '' ) ;
187- throw new Error ( errorMessage ) ;
188- }
189- if ( ! Array . isArray ( binding . members ) || ! binding . members . length ) {
190- const errorMessage = [
191- `The function "${ functionName } " has no members specified for an IAM binding.` ,
192- ' Each binding requires at least one member to be assigned. See the IAM documentation' ,
193- ' for details on configuring members: https://cloud.google.com/iam/docs/overview' ,
194- ] . join ( '' ) ;
195- throw new Error ( errorMessage ) ;
196- }
197- } ) ;
198- }
199- } ;
200-
201160const getFunctionTemplate = ( funcObject , projectName , region , sourceArchiveUrl ) => {
202161 //eslint-disable-line
203162 return {
@@ -212,10 +171,5 @@ const getFunctionTemplate = (funcObject, projectName, region, sourceArchiveUrl)
212171 function : funcObject . name ,
213172 sourceArchiveUrl,
214173 } ,
215- accessControl : {
216- gcpIamPolicy : {
217- bindings : [ ] ,
218- } ,
219- } ,
220174 } ;
221175} ;
0 commit comments