(cli): cdk migrate fails to process Fn::Sub within Fn::ImportValue #29014
Labels
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p1
package/tools
Related to AWS CDK Tools or CLI
toolkit/migrate
Related to cdk migrate
Describe the bug
It is common to use the intrinsic function Fn::Sub within Fn::ImportValue, to import cross-stack values in an environment-specific way (e.g. selecting on a dev, test or production environment stack export). An example of this syntax is given on the
Fn::ImportValue
dcumentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html#w9aac34c28c46c15The CDK Migrate CLI command fails currently when processing templates containing this syntax with the error
Expected Behavior
cdk migrate to be able to generate CDK code for templates containing
Current Behavior
An error raised due to the Fn::Sub within Fn::ImportValue not being a string value
Reproduction Steps
Run
cdk migrate --stack-name my-stack --language typescript --from-path <template> --output-path <path for output>
using the following template:The error will be raised
Run the same command with the following template and the template is processed successfully:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.126.0 (build fb74c41)
Framework Version
No response
Node.js Version
v18.17.1
OS
20.04.6 LTS (Focal Fossa)
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: