-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(cli): cdk migrate fails to process Fn::Sub within Fn::ImportValue #29014
Comments
Thanks for reporting this issue, I could reproduce the error. |
Looks like the recursion doing the translating is not going deep enough. Adding this task to cdk-from-cfn for fixing. |
The fix for this was released in v2.132. |
|
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: