- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.3k
 
Description
Describe the bug
The Landing Zone Accelerator solution leverages the custom_resources module to create service-linked roles via CDK custom resources. When this custom resource Lambda function is invoked several times in succession, users intermittently receive the following error:
Received response status [FAILED] from custom resource. Message returned: AccessDeniedException: Resource is not in the state functionActive
We believe this is the result of queuing incoming requests and the role attached to the cdk.custom_resources.Provider function is missing the permission: lambda:GetFunctionConfiguration
Expected Behavior
Custom resource provider implements appropriate permissions and retries to execute successfully when invoked several times in succession.
Current Behavior
Transient failures:
Received response status [FAILED] from custom resource. Message returned: AccessDeniedException: Resource is not in the state functionActive
Reproduction Steps
Deploy v1.4.3 of the Landing Zone Accelerator on AWS.
For a smaller sample that can be extracted without deploying the entire LZA solution, you may use this custom resource construct that is used by LZA to create the service-linked roles:
Possible Solution
Add lambda:GetFunctionConfiguration permission to the provider Lambda function's IAM role.
Additional Information/Context
No response
CDK CLI Version
2.79
Framework Version
No response
Node.js Version
16.20.1
OS
Amazon Linux
Language
Typescript
Language Version
No response
Other information
No response