Repository: getmoto/moto (python)

Issue:
Moto doesn't support mock cloudformation which has a lambda resource deployed as container
## Reporting Bugs

**how to reproduce the issue**
```
import os
import pytest
import json
import boto3
from moto import mock_aws
from unittest.mock import Mock

dummy_template = {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Resources": {
        "LambdaFunction": {
            "Type": "AWS::Lambda::Function",
            "Properties": {
                "FunctionName": "ContainerLambdaFunction",
                "Role": "dummy-role-arn",
                "Code": {
                    "ImageUri": "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-lambda-container:latest"
                    },
                "PackageType": "Image",
                "MemorySize": 128,
                "Timeout": 30
            }
        }
    }
}
dummy_template_json = json.dumps(dummy_template)

@pytest.fixture(scope="function")
def aws_credentials():
    print('Setting up AWS credentials for mocked boto3 clients...')
    os.environ['AWS_ACCESS_KEY_ID'] = 'testing'
    os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'
    os.environ['AWS_SECURITY_TOKEN'] = 'testing'
    os.environ['AWS_SESSION_TOKEN'] = 'testing'
    os.environ['AWS_DEFAULT_REGION'] = 'eu-west-1'


@pytest.fixture(scope="function")
def cloudformation(aws_credentials):
    with mock_aws():
        yield boto3.client('cloudformation', region_name='us-west-2')

def test_lambda_with_container_deployment(cloudformation):
    cloudformation.create_stack(StackName='dummy-stack-name', TemplateBody=dummy_template_json)

```

**what you expected to happen**: test not fail
**what actually happens**
```
        # required
        spec = {
            "Code": properties["Code"],
            "FunctionName": resource_name,
>           "Handler": properties["Handler"],
            "Role": properties["Role"],
            "Runtime": properties["Runtime"],
        }
E       KeyError: 'Handler'
```
Error was thrown from [this line](https://github.com/getmoto/moto/blob/master/moto/awslambda/models.py#L1153)

**moto version: moto[all]==5.0.11**



Pull request:
AWSLambda: Allow CF creation of Lambdas with ImageURI's
Fixes #7853 

Patch:
diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py
index ce66fef66..7943659cc 100644
--- a/moto/awslambda/models.py
+++ b/moto/awslambda/models.py
@@ -1150,9 +1150,9 @@ class LambdaFunction(CloudFormationModel, DockerModel):
         spec = {
             "Code": properties["Code"],
             "FunctionName": resource_name,
-            "Handler": properties["Handler"],
+            "Handler": properties.get("Handler"),
             "Role": properties["Role"],
-            "Runtime": properties["Runtime"],
+            "Runtime": properties.get("Runtime"),
         }
 
         # NOTE: Not doing `properties.get(k, DEFAULT)` to avoid duplicating the


Test patch:
diff --git a/tests/test_awslambda/test_awslambda_cloudformation.py b/tests/test_awslambda/test_awslambda_cloudformation.py
index 09e3edf8c..6e1198a0f 100644
--- a/tests/test_awslambda/test_awslambda_cloudformation.py
+++ b/tests/test_awslambda/test_awslambda_cloudformation.py
@@ -1,4 +1,5 @@
 import io
+import json
 import re
 import zipfile
 from string import Template
@@ -54,6 +55,26 @@ template = Template(
 }"""
 )
 
+
+code_image_template = {
+    "AWSTemplateFormatVersion": "2010-09-09",
+    "Resources": {
+        "LambdaFunction": {
+            "Type": "AWS::Lambda::Function",
+            "Properties": {
+                "FunctionName": "ContainerLambdaFunction",
+                "Role": "dummy-role-arn",
+                "Code": {
+                    "ImageUri": "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-lambda-container:latest"
+                },
+                "PackageType": "Image",
+                "MemorySize": 128,
+                "Timeout": 30,
+            },
+        }
+    },
+}
+
 event_source_mapping_template = Template(
     """{
     "AWSTemplateFormatVersion": "2010-09-09",
@@ -114,6 +135,25 @@ def test_lambda_can_be_deleted_by_cloudformation():
     assert e.value.response["Error"]["Code"] == "ResourceNotFoundException"
 
 
+@mock_aws
+def test_lambda_with_code_image_can_be_created():
+    our_template = code_image_template.copy()
+    our_template["Resources"]["LambdaFunction"]["Properties"]["Role"] = get_role_arn()
+    stack_name = f"stack{str(uuid4())[0:6]}"
+    cf = boto3.client("cloudformation", region_name="us-east-1")
+    cf.create_stack(StackName=stack_name, TemplateBody=json.dumps(code_image_template))
+
+    lmbda = boto3.client("lambda", region_name="us-east-1")
+    functions = lmbda.list_functions()["Functions"]
+    function_names = [f["FunctionName"] for f in functions]
+    assert "ContainerLambdaFunction" in function_names
+
+    cf.delete_stack(StackName=stack_name)
+    functions = lmbda.list_functions()["Functions"]
+    function_names = [f["FunctionName"] for f in functions]
+    assert "ContainerLambdaFunction" not in function_names
+
+
 @mock_aws
 def test_event_source_mapping_create_from_cloudformation_json():
     sqs = boto3.resource("sqs", region_name="us-east-1")