Skip to content

migrate CLI: Lambda "RecursiveLoop" property not supported #642

Open
@ServerlessSam

Description

@ServerlessSam

Describe the bug

When calling the cdk migrate CLI call for a CloudFormation template inlcuding the RecursiveLoop property, the following error is returned from the CLI:

❌  Migrate failed for `<STACK NAME>`: <STACK NAME> could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00MyLambdaFunction1325700kVilc of type AWS::Lambda::Function
<STACK NAME> could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00MyLambdaFunction1325700kVilc of type AWS::Lambda::Function

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

N/A

Expected Behavior

Migration command completes successfully

Current Behavior

❌  Migrate failed for `<STACK NAME>`: <STACK NAME> could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00MyLambdaFunction1325700kVilc of type AWS::Lambda::Function
<STACK NAME> could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00MyLambdaFunction1325700kVilc of type AWS::Lambda::Function

is returned

Reproduction Steps

Cloudformation template:

---
Metadata:
  TemplateId: "arn:aws:cloudformation:eu-west-2:724772056462:generatedTemplate/8445f8eb-9b94-41a7-9bd2-9fc10e6bb55f"
Parameters:
  LambdaFunction00MyLambdaFunction1325700kVilcCodeS3Keydw9i0:
    NoEcho: "true"
    Type: "String"
    Description: "The Amazon S3 key of the deployment package."
  LambdaFunction00MyLambdaFunction1325700kVilcCodeSourceKMSKeyArn3AhN5:
    NoEcho: "true"
    Type: "String"
    Description: "Value of write only property Code/SourceKMSKeyArn of resource LambdaFunction00MyLambdaFunction1325700kVilc."
  LambdaFunction00MyLambdaFunction1325700kVilcCodeS3BucketFOeva:
    NoEcho: "true"
    Type: "String"
    Description: "An Amazon S3 bucket in the same AWS-Region as your function. The\
      \ bucket can be in a different AWS-account."
  LambdaFunction00MyLambdaFunction1325700kVilcCodeImageUriLKe5i:
    NoEcho: "true"
    Type: "String"
    Description: "URI of a [container image](https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html)\
      \ in the Amazon ECR registry."
  LambdaFunction00MyLambdaFunction1325700kVilcCodeS3ObjectVersion74uiH:
    NoEcho: "true"
    Type: "String"
    Description: "For versioned objects, the version of the deployment package object\
      \ to use."
  LambdaFunction00MyLambdaFunction1325700kVilcCodeZipFilemFzYH:
    NoEcho: "true"
    Type: "String"
    Description: "(Node.js and Python) The source code of your Lambda function. If\
      \ you include your function source inline with this parameter, CFN places it\
      \ in a file named ``index`` and zips it to create a [deployment package](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html).\
      \ This zip file cannot exceed 4MB. For the ``Handler`` property, the first part\
      \ of the handler identifier must be ``index``. For example, ``index.handler``.\n\
      \  For JSON, you must escape quotes and special characters such as newline (``\\\
      n``) with a backslash.\n If you specify a function that interacts with an AWS\
      \ CloudFormation custom resource, you don't have to write your own functions\
      \ to send responses to the custom resource that invoked the function. AWS CloudFormation\
      \ provides a response module ([cfn-response](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-lambda-function-code-cfnresponsemodule.html))\
      \ that simplifies sending responses. See [Using Lambda with CloudFormation](https://docs.aws.amazon.com/lambda/latest/dg/services-cloudformation.html)\
      \ for details."
Resources:
  S3Bucket00myuniquebucketname1325700EybYp:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::S3::Bucket"
    DeletionPolicy: "Retain"
    Properties:
      PublicAccessBlockConfiguration:
        RestrictPublicBuckets: true
        IgnorePublicAcls: true
        BlockPublicPolicy: true
        BlockPublicAcls: true
      BucketName: "my-unique-bucket-name-13257"
      OwnershipControls:
        Rules:
        - ObjectOwnership: "BucketOwnerEnforced"
      BucketEncryption:
        ServerSideEncryptionConfiguration:
        - BucketKeyEnabled: false
          ServerSideEncryptionByDefault:
            SSEAlgorithm: "AES256"
  ApiGatewayRestApi00ma1fkrumwe00qPg6p:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::ApiGateway::RestApi"
    DeletionPolicy: "Retain"
    Properties:
      ApiKeySourceType: "HEADER"
      EndpointConfiguration:
        Types:
        - "EDGE"
      DisableExecuteApiEndpoint: false
      Name: "MyAPI-13257"
  ApiGatewayStage00prod00Y2cUQ:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::ApiGateway::Stage"
    DeletionPolicy: "Retain"
    Properties:
      RestApiId:
        Ref: "ApiGatewayRestApi00ma1fkrumwe00qPg6p"
      DeploymentId:
        Fn::GetAtt:
        - "ApiGatewayDeployment008olkcn00UHlcc"
        - "DeploymentId"
      StageName: "prod"
      TracingEnabled: false
      CacheClusterEnabled: false
  LambdaPermission00functionMyLambdaFunction1325700B9a7e:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::Lambda::Permission"
    DeletionPolicy: "Retain"
    Properties:
      FunctionName:
        Fn::GetAtt:
        - "LambdaFunction00MyLambdaFunction1325700kVilc"
        - "Arn"
      Action: "lambda:InvokeFunction"
      SourceArn: "arn:aws:execute-api:eu-west-2:724772056462:ma1fkrumwe/*/*/*"
      Principal: "apigateway.amazonaws.com"
  ApiGatewayDeployment008olkcn00UHlcc:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::ApiGateway::Deployment"
    DeletionPolicy: "Retain"
    Properties:
      RestApiId:
        Ref: "ApiGatewayRestApi00ma1fkrumwe00qPg6p"
  DynamoDBTable00MyDynamoDBTable1325700QHjLe:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::DynamoDB::Table"
    DeletionPolicy: "Retain"
    Properties:
      SSESpecification:
        SSEEnabled: false
      TableName: "MyDynamoDBTable-13257"
      AttributeDefinitions:
      - AttributeType: "S"
        AttributeName: "ID"
      ContributorInsightsSpecification:
        Enabled: false
      BillingMode: "PAY_PER_REQUEST"
      PointInTimeRecoverySpecification:
        PointInTimeRecoveryEnabled: false
      KeySchema:
      - KeyType: "HASH"
        AttributeName: "ID"
      DeletionProtectionEnabled: false
      Tags: []
      TimeToLiveSpecification:
        Enabled: false
  LambdaFunction00MyLambdaFunction1325700kVilc:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::Lambda::Function"
    DeletionPolicy: "Retain"
    Properties:
      MemorySize: 128
      Description: ""
      TracingConfig:
        Mode: "PassThrough"
      Timeout: 3
      RuntimeManagementConfig:
        UpdateRuntimeOn: "Auto"
      Handler: "lambda_function.lambda_handler"
      Code:
        SourceKMSKeyArn:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeSourceKMSKeyArn3AhN5"
        S3ObjectVersion:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeS3ObjectVersion74uiH"
        S3Bucket:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeS3BucketFOeva"
        ZipFile:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeZipFilemFzYH"
        ImageUri:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeImageUriLKe5i"
        S3Key:
          Ref: "LambdaFunction00MyLambdaFunction1325700kVilcCodeS3Keydw9i0"
      Role:
        Fn::GetAtt:
        - "IAMRole00LambdaExecutionRole1325700rRObU"
        - "Arn"
      FileSystemConfigs: []
      FunctionName: "MyLambdaFunction-13257"
      Runtime: "python3.8"
      PackageType: "Zip"
      LoggingConfig:
        LogFormat: "Text"
        LogGroup: "/aws/lambda/MyLambdaFunction-13257"
      RecursiveLoop: "Terminate"
      EphemeralStorage:
        Size: 512
      Architectures:
      - "x86_64"
  IAMRole00LambdaExecutionRole1325700rRObU:
    UpdateReplacePolicy: "Retain"
    Type: "AWS::IAM::Role"
    DeletionPolicy: "Retain"
    Properties:
      Path: "/"
      ManagedPolicyArns:
      - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
      MaxSessionDuration: 3600
      RoleName: "LambdaExecutionRole-13257"
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Action: "sts:AssumeRole"
          Effect: "Allow"
          Principal:
            Service: "lambda.amazonaws.com"

Command: cdk migrate --stack-name <STACK NAME> --from-path <PATH TO TEMPLATE> --language typescript

Possible Solution

RecursiveLoop is a relatively new attribute added to the Lambda Function CF resource. I expect the migrate command is using an out of date lambda data model

Additional Information/Context

No response

CDK CLI Version

2.161.1

Framework Version

No response

Node.js Version

v20.17.0

OS

Mac

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions