@@ -179,6 +179,38 @@ func (rm *resourceManager) updateFunctionConfiguration(
179179 }
180180 }
181181
182+ if delta .DifferentAt ("Spec.Environment" ) {
183+ environment := & svcsdk.Environment {}
184+ if dspec .Environment != nil {
185+ environment .Variables = dspec .Environment .DeepCopy ().Variables
186+ }
187+ input .Environment = environment
188+ }
189+
190+ if delta .DifferentAt ("Spec.EphemeralStorage" ) {
191+ ephemeralStorage := & svcsdk.EphemeralStorage {}
192+ if dspec .EphemeralStorage != nil {
193+ ephemeralStorageCopy := dspec .EphemeralStorage .DeepCopy ()
194+ ephemeralStorage .Size = ephemeralStorageCopy .Size
195+ }
196+ input .EphemeralStorage = ephemeralStorage
197+ }
198+
199+ if delta .DifferentAt ("Spec.FileSystemConfigs" ) {
200+ fileSystemConfigs := []* svcsdk.FileSystemConfig {}
201+ if len (dspec .FileSystemConfigs ) > 0 {
202+ for _ , elem := range dspec .FileSystemConfigs {
203+ elemCopy := elem .DeepCopy ()
204+ fscElem := & svcsdk.FileSystemConfig {
205+ Arn : elemCopy .ARN ,
206+ LocalMountPath : elemCopy .LocalMountPath ,
207+ }
208+ fileSystemConfigs = append (fileSystemConfigs , fscElem )
209+ }
210+ input .FileSystemConfigs = fileSystemConfigs
211+ }
212+ }
213+
182214 if delta .DifferentAt ("Spec.Handler" ) {
183215 if dspec .Handler != nil {
184216 input .Handler = aws .String (* dspec .Handler )
@@ -187,6 +219,19 @@ func (rm *resourceManager) updateFunctionConfiguration(
187219 }
188220 }
189221
222+ if delta .DifferentAt ("Spec.ImageConfig" ) {
223+ if dspec .ImageConfig != nil && dspec .Code .ImageURI != nil && * dspec .Code .ImageURI != "" {
224+ imageConfig := & svcsdk.ImageConfig {}
225+ if dspec .ImageConfig != nil {
226+ imageConfigCopy := dspec .ImageConfig .DeepCopy ()
227+ imageConfig .Command = imageConfigCopy .Command
228+ imageConfig .EntryPoint = imageConfigCopy .EntryPoint
229+ imageConfig .WorkingDirectory = imageConfigCopy .WorkingDirectory
230+ }
231+ input .ImageConfig = imageConfig
232+ }
233+ }
234+
190235 if delta .DifferentAt ("Spec.KMSKeyARN" ) {
191236 if dspec .KMSKeyARN != nil {
192237 input .KMSKeyArn = aws .String (* dspec .KMSKeyARN )
@@ -195,11 +240,14 @@ func (rm *resourceManager) updateFunctionConfiguration(
195240 }
196241 }
197242
198- if delta .DifferentAt ("Spec.Role" ) {
199- if dspec .Role != nil {
200- input .Role = aws .String (* dspec .Role )
201- } else {
202- input .Role = aws .String ("" )
243+ if delta .DifferentAt ("Spec.Layers" ) {
244+ layers := []* string {}
245+ if len (dspec .Layers ) > 0 {
246+ for _ , iter := range dspec .Layers {
247+ var elem string = * iter
248+ layers = append (layers , & elem )
249+ }
250+ input .Layers = layers
203251 }
204252 }
205253
@@ -211,47 +259,28 @@ func (rm *resourceManager) updateFunctionConfiguration(
211259 }
212260 }
213261
214- if delta .DifferentAt ("Spec.Timeout " ) {
215- if dspec .Timeout != nil {
216- input .Timeout = aws .Int64 (* dspec .Timeout )
262+ if delta .DifferentAt ("Spec.Role " ) {
263+ if dspec .Role != nil {
264+ input .Role = aws .String (* dspec .Role )
217265 } else {
218- input .Timeout = aws .Int64 (0 )
219- }
220- }
221-
222- if delta .DifferentAt ("Spec.Environment" ) {
223- environment := & svcsdk.Environment {}
224- if dspec .Environment != nil {
225- environment .Variables = dspec .Environment .DeepCopy ().Variables
266+ input .Role = aws .String ("" )
226267 }
227- input .Environment = environment
228268 }
229269
230- if delta .DifferentAt ("Spec.FileSystemConfigs" ) {
231- fileSystemConfigs := []* svcsdk.FileSystemConfig {}
232- if len (dspec .FileSystemConfigs ) > 0 {
233- for _ , elem := range dspec .FileSystemConfigs {
234- elemCopy := elem .DeepCopy ()
235- fscElem := & svcsdk.FileSystemConfig {
236- Arn : elemCopy .ARN ,
237- LocalMountPath : elemCopy .LocalMountPath ,
238- }
239- fileSystemConfigs = append (fileSystemConfigs , fscElem )
240- }
241- input .FileSystemConfigs = fileSystemConfigs
270+ if delta .DifferentAt (("Spec.SnapStart" )) {
271+ snapStart := & svcsdk.SnapStart {}
272+ if dspec .SnapStart != nil {
273+ snapStartCopy := dspec .SnapStart .DeepCopy ()
274+ snapStart .ApplyOn = snapStartCopy .ApplyOn
242275 }
276+ input .SnapStart = snapStart
243277 }
244278
245- if delta .DifferentAt ("Spec.ImageConfig" ) {
246- if dspec .ImageConfig != nil && dspec .Code .ImageURI != nil && * dspec .Code .ImageURI != "" {
247- imageConfig := & svcsdk.ImageConfig {}
248- if dspec .ImageConfig != nil {
249- imageConfigCopy := dspec .ImageConfig .DeepCopy ()
250- imageConfig .Command = imageConfigCopy .Command
251- imageConfig .EntryPoint = imageConfigCopy .EntryPoint
252- imageConfig .WorkingDirectory = imageConfigCopy .WorkingDirectory
253- }
254- input .ImageConfig = imageConfig
279+ if delta .DifferentAt ("Spec.Timeout" ) {
280+ if dspec .Timeout != nil {
281+ input .Timeout = aws .Int64 (* dspec .Timeout )
282+ } else {
283+ input .Timeout = aws .Int64 (0 )
255284 }
256285 }
257286
@@ -273,24 +302,6 @@ func (rm *resourceManager) updateFunctionConfiguration(
273302 input .VpcConfig = VPCConfig
274303 }
275304
276- if delta .DifferentAt ("Spec.EphemeralStorage" ) {
277- ephemeralStorage := & svcsdk.EphemeralStorage {}
278- if dspec .EphemeralStorage != nil {
279- ephemeralStorageCopy := dspec .EphemeralStorage .DeepCopy ()
280- ephemeralStorage .Size = ephemeralStorageCopy .Size
281- }
282- input .EphemeralStorage = ephemeralStorage
283- }
284-
285- if delta .DifferentAt (("Spec.SnapStart" )) {
286- snapStart := & svcsdk.SnapStart {}
287- if dspec .SnapStart != nil {
288- snapStartCopy := dspec .SnapStart .DeepCopy ()
289- snapStart .ApplyOn = snapStartCopy .ApplyOn
290- }
291- input .SnapStart = snapStart
292- }
293-
294305 _ , err = rm .sdkapi .UpdateFunctionConfigurationWithContext (ctx , input )
295306 rm .metrics .RecordAPICall ("UPDATE" , "UpdateFunctionConfiguration" , err )
296307 if err != nil {
0 commit comments