aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.88k forks source link

CDK Migrate/GroundStation: Cannot migrate AWS-provided CloudFormation Template #29752

Open trahloff opened 6 months ago

trahloff commented 6 months ago

Describe the bug

When trying to convert the CloudFormation YAML from https://github.com/aws-samples/aws-groundstation-s3-data-delivery to CDK (Typescript), it will not complete and throw an error.

Expected Behavior

The command cdk migrate --stack-name GS-S3-Delivery-Receiver --language typescript --from-path ./cfn/jpss1-gs-to-s3.yml results in CDK code.

Current Behavior

The command results in the error "Multi-line single-quoted string needs to be sufficiently indented".

Reproduction Steps

  1. `$ git clone git@github.com:aws-samples/aws-groundstation-s3-data-delivery.git"
  2. $ cd aws-groundstation-s3-data-delivery
  3. $ cdk migrate --stack-name GS-S3-Delivery-Receiver --language typescript --from-path ./cfn/jpss1-gs-to-s3.yml

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.136.0 (build 94fd33b)

Framework Version

No response

Node.js Version

v20.12.1

OS

macOS 14.4 (23E214) Darwin 23.4.0

Language

TypeScript

Language Version

No response

Other information

No response

pahud commented 5 months ago

Thank you. We will bring this up to the team for inputs.

TheRealAmazonKendra commented 5 months ago

This is quite an odd one that I've never seen before.

TheRealAmazonKendra commented 5 months ago

Ahhhh. I believe I see the problem. There is a Base64 function in there and contains a long long string that contains a few things that are tripping us up. There error here is super misleading, but we did just improve our error handling and messaging so I don't think there's any action item left there, per say.

I should have a fix out for this by our next release.

TheRealAmazonKendra commented 5 months ago

FYI this will require like three fixes or so, so the one I linked isn't the only one needed. I'll do a merge from latest of cdk-from-cfn once I get all the fixes in and use that one to auto-close this one. That GroundStation template provided a fount of use-cases where we screwed up edge cases so I'm sorry that you're encountering bugs but I'm also pretty excited that you attempted this particular template. I'm still on track to get this fixed before our next release. I'll update if that changes.

trahloff commented 4 months ago

Hi @TheRealAmazonKendra, thank you very much! This really made my day seeing this extensive response.

Please let me know if I can support in any way! I will try it and report back as soon as the fixes become available.