iann0036 / AWSConsoleRecorder

Records actions made in the AWS Management Console and outputs the equivalent CLI/SDK commands and CloudFormation/Terraform templates.
MIT License
1.43k stars 87 forks source link

Strange behavior for References to Logical IDs (CFN) #32

Closed ustrahlendorf closed 5 years ago

ustrahlendorf commented 5 years ago

Describe the bug I see a strange behavior regarding values for references to logical id's. I have created a simple VPC with 2 subnets and Routing tables etc. This is an example what I got for the CFN subnet resource: ec2733a861: Type: "AWS::EC2::VPCGatewayAttachment" Properties: VpcId: !Ref ec28471949 InternetGatewayId: !Sub "${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec282e532e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2eb0ae6e.Ipv6CidrBlocks}${ec2320da02}"

I see this entries with Ipv6CidrBlocks at nearly every resource. I also don't understand why the recorder is using !Sub function and not !Ref.

iann0036 commented 5 years ago

Thanks for raising.

I believe this is caused when a return value is an empty array, which was being handled incorrectly. I've tried to mitigate this in 0.3.21, but haven't managed to completely confirm.

Could you see if the new version helps avoid this?

ustrahlendorf commented 5 years ago

Hi Ian, top, just checked 0.3.21 and it works fine for me. The mentioned issue was gone. Found two other bugs, will raise separate new issues about them. I take care that you have no boredum ;-). take care Uwe