When you create a Lambda permission you send the __statement id__ as mandatory parameter.

https://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html#API_AddPermission_RequestSyntax

However this id is generated by a random value. 

https://github.com/localstack/localstack/blob/b3917bf248b77ced8ef80a3d5c0561960066db5d/localstack/services/awslambda/lambda_api.py#L927

Due to this problem, the tools like Terraform or Ansible fail when it has to be retrieved to check the existence of this element.

If you agree I could make a PR with the fix and its test.
version=LOCALSTACK_MAVEN_VERSION, url=MAVEN_BASE_URL, name='localstack-utils')
TEST_LAMBDA_LIBS = ['localstack', 'localstack_client', 'requests',
    'psutil', 'urllib3', 'chardet', 'certifi', 'idna', 'pip', 'dns']
class LambdaTestBase(unittest.TestCase):
    def check_lambda_logs(self, func_name, expected_lines=[]):
        logs_client = aws_stack.connect_to_service('logs')
        log_group_name = '/aws/lambda/%s' % func_name
        streams = logs_client.describe_log_streams(logGroupName=log_group_name)['logStreams']
        streams = sorted(streams, key=lambda x: x['creationTime'], reverse=True)
        log_events = logs_client.get_log_events(
            logGroupName=log_group_name, logStreamName=streams[0]['logStreamName'])['events']
        log_messages = [e['message'] for e in log_events]
        for line in expected_lines:
            if '.*' in line:
                found = [re.match(line, m) for m in log_messages]
                if any(found):
                    continue
            self.assertIn(line, log_messages)
class TestLambdaBaseFeatures(unittest.TestCase):
    def test_forward_to_fallback_url_dynamodb(self):
        db_table = 'lambda-records'
        ddb_client = aws_stack.connect_to_service('dynamodb')
        def num_items():
            return len((run_safe(ddb_client.scan, TableName=db_table) or {'Items': []})['Items'])
        items_before = num_items()
        self._run_forward_to_fallback_url('dynamodb://%s' % db_table)
        items_after = num_items()
        self.assertEqual(items_after, items_before + 3)
    def test_forward_to_fallback_url_http(self):
        class MyUpdateListener(ProxyListener):