@@ -24,7 +24,6 @@ module.exports = {
24
24
validateHandlerProperty ( funcObject , functionName ) ;
25
25
validateEventsProperty ( funcObject , functionName ) ;
26
26
validateVpcConnectorProperty ( funcObject , functionName ) ;
27
- validateIamProperty ( funcObject , functionName ) ;
28
27
29
28
const funcTemplate = getFunctionTemplate (
30
29
funcObject ,
@@ -52,11 +51,6 @@ module.exports = {
52
51
_ . get ( this , 'serverless.service.provider.environment' ) ,
53
52
funcObject . environment // eslint-disable-line comma-dangle
54
53
) ;
55
- funcTemplate . accessControl . gcpIamPolicy . bindings = _ . unionBy (
56
- _ . get ( funcObject , 'iam.bindings' ) ,
57
- _ . get ( this , 'serverless.service.provider.iam.bindings' ) ,
58
- 'role'
59
- ) ;
60
54
61
55
if ( ! funcTemplate . properties . serviceAccountEmail ) {
62
56
delete funcTemplate . properties . serviceAccountEmail ;
@@ -89,14 +83,6 @@ module.exports = {
89
83
90
84
funcTemplate . properties . httpsTrigger = { } ;
91
85
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
- }
100
86
}
101
87
if ( eventType === 'event' ) {
102
88
const type = funcObject . events [ 0 ] . event . eventType ;
@@ -109,10 +95,6 @@ module.exports = {
109
95
funcTemplate . properties . eventTrigger . resource = resource ;
110
96
}
111
97
112
- if ( ! funcTemplate . accessControl . gcpIamPolicy . bindings . length ) {
113
- delete funcTemplate . accessControl ;
114
- }
115
-
116
98
this . serverless . service . provider . compiledConfigurationTemplate . resources . push ( funcTemplate ) ;
117
99
} ) ;
118
100
@@ -175,29 +157,6 @@ const validateVpcConnectorProperty = (funcObject, functionName) => {
175
157
}
176
158
} ;
177
159
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
-
201
160
const getFunctionTemplate = ( funcObject , projectName , region , sourceArchiveUrl ) => {
202
161
//eslint-disable-line
203
162
return {
@@ -212,10 +171,5 @@ const getFunctionTemplate = (funcObject, projectName, region, sourceArchiveUrl)
212
171
function : funcObject . name ,
213
172
sourceArchiveUrl,
214
173
} ,
215
- accessControl : {
216
- gcpIamPolicy : {
217
- bindings : [ ] ,
218
- } ,
219
- } ,
220
174
} ;
221
175
} ;
0 commit comments