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 86 forks source link

Cloudformation output produced for AWS::Glue::Connection is incorrect #37

Open alytle opened 5 years ago

alytle commented 5 years ago

Describe the bug When recording a Glue Connection, the resulting Cloudformation text is malformed.

Related Mapping glue.createConnection

Related Language Cloudformation

To Reproduce

  1. Create a Glue Connection from

Expected behavior This is what I get currently:

AWSTemplateFormatVersion: "2010-09-09"
Metadata:
    Generator: "console-recorder"
Description: ""
Resources:
    glue2a9e07f:
        Type: "AWS::Glue::Connection"
        Properties:
            ConnectionInput: 
              - 
                action: "com.amazonaws.console.glue.awssdk.shared.context.AWSGlueContext.createConnection"
                parameters: 
                  - 
                    connectionInput: 
                        physicalConnectionRequirements: 
                            availabilityZone: "us-east-1d"
                            subnetId: "<redacted>"
                            securityGroupIdList: 
                              - "<redacted>"
                        connectionType: "JDBC"
                        description: ""
                        name: "my-connection-name"
                        connectionProperties: 
                            USERNAME: "<redacted>"
                            PASSWORD: "<redacted>"
                            JDBC_CONNECTION_URL: "jdbc:<redacted>"
                            JDBC_ENFORCE_SSL: "true"

It should be something like:

AWSTemplateFormatVersion: "2010-09-09"
Description: ""

Resources:
  GlueAuroraCrawler:
    Type: "AWS::Glue::Connection"
    Properties:
      ConnectionInput:
        PhysicalConnectionRequirements:
          AvailabilityZone: "us-east-1d"
          SubnetId: "<redacted>"
          SecurityGroupIdList:
            - "<redacted>"
        ConnectionType: "JDBC"
        Description: ""
        Name: "my-connection-name"
        ConnectionProperties:
          USERNAME: "<redacted>"
          PASSWORD: "<redacted>"
          JDBC_CONNECTION_URL: "jdbc:<redacted>"
          JDBC_ENFORCE_SSL: "true"
      CatalogId: !Ref AWS::AccountId

Screenshots n/a

Additional context Having a look at the Boto3 code, it looks like this might not be a Cloudformation output problem, but rather how you're parsing the Glue API call results.

If you're accepting PRs, I can take a stab at fixing this one.

iann0036 commented 5 years ago

PRs happily accepted if you have the time, otherwise I'll fix this up in a few days.

Thanks for reporting!