Skip to content

cdk migrate: nested shortform functions fail to migrate #30810

Open
@Shwaring

Description

@Shwaring

Describe the bug

Cloudformation intrinisc finctions have short froms and long forms. When functions using the short form you get the unhelpful error message migrate failed for : <stackname> could not be generated because <element>: untagged and internally tagged enums do not support enum input at line 141 column 25
I believe this error message is unrelated and is simply a fallback error for some reason.
The following snippet shows that converting to long form functions migrates correctly but the nested shortform functions fail.

Expected Behavior

Generate a valid CDK stack

Current Behavior

migrate fails with migrate failed for : <stackname> could not be generated because <element>: untagged and internally tagged enums do not support enum input at line <line> column <column> error

Reproduction Steps

run cdk migrate --stack-name my-stack --language typescript --from-path <template> --output-path <path for output> using

AWSTemplateFormatVersion: "2010-09-09"
Description: ABS Insights Aurora Postgres

Conditions:
  cUseDBSnapshot: 
    Fn::Not: 
      Fn::Equals: 
        - Ref: pDBSnapshotIdentifier
        - ""
  cAddCollectServicesIngress: 
    Fn::Not: 
      Fn::Equals: [Ref: pCollectServicesIP , ""]
  cAddCollectServices2Ingress: !Not [!Equals [!Ref pCollectServicesIP2 , ""]]
  cAddCollectServices3Ingress: !Not [!Equals [!Ref pCollectServicesIP3 , ""]]
  cAddCollectServices4Ingress: !Not [!Equals [!Ref pCollectServicesIP4 , ""]]
  cAddCollectServices5Ingress: !Not [!Equals [!Ref pCollectServicesIP5 , ""]]
  cArcGISFirstIPIngress: !Not [!Equals [!Ref pArcGISFirstIP , ""]]
  cArcGISSecondIPIngress: !Not [!Equals [!Ref pArcGISSecondIP , ""]]
  cCreateAdminSecret: !Not [!Condition cUseDBSnapshot]

Possible Solution

Current workaround is to expand these functions into the long forms

Additional Information/Context

No response

CDK CLI Version

2.145.0

Framework Version

No response

Node.js Version

v20.14.0

OS

linux

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudformationRelated to AWS CloudFormationbugThis issue is a bug.cliIssues related to the CDK CLIeffort/mediumMedium work item – several days of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions