aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 13 forks source link

Support SASL authentication types in glue.ConnectionPropertyKey_Values() #564

Closed mforeman19 closed 10 months ago

mforeman19 commented 12 months ago

Describe the bug

It appears that glue's ConnectionPropertyKey_Values() does not support SASL types. I can't link file directly as its too large, but the api.go file contains a set of constants used in that function: https://raw.githubusercontent.com/aws/aws-sdk-go/v1.44.298/service/glue/api.go

They do not fully match all the connection types that can be passed into the SDK: https://docs.aws.amazon.com/sdk-for-go/api/service/glue/#Connection --> Notice here that types like KAFKA_SASL_SCRAM_USERNAME and KAFKA_SASL_SCRAM_PASSWORD are there but missing in ConnectionPropertyKey_Values()

The AWS Docs don't reflect these types either sadly: https://docs.aws.amazon.com/glue/latest/webapi/API_ConnectionInput.html

But the console does: image

Expected Behavior

I would be able to use SASL auth types with the ConnectionPropertyKey_Values() function. Terraform uses it here to validate connection properties: https://github.com/hashicorp/terraform-provider-aws/blob/a113ad213d2685c90b2d4b9d69fc6a18cd021da4/internal/service/glue/connection.go#L56C38-L56C66

Current Behavior

If I pass in KAFKA_SASL_MECHANISM = "SCRAM-SHA-512", I get the below error (via Terraform but it uses glue.ConnectionPropertyKey_Values() under the hood)

Error: expected connection_properties to be one of [HOST PORT USERNAME PASSWORD ENCRYPTED_PASSWORD JDBC_DRIVER_JAR_URI JDBC_DRIVER_CLASS_NAME JDBC_ENGINE JDBC_ENGINE_VERSION CONFIG_FILES INSTANCE_ID JDBC_CONNECTION_URL JDBC_ENFORCE_SSL CUSTOM_JDBC_CERT SKIP_CUSTOM_JDBC_CERT_VALIDATION CUSTOM_JDBC_CERT_STRING CONNECTION_URL KAFKA_BOOTSTRAP_SERVERS KAFKA_SSL_ENABLED KAFKA_CUSTOM_CERT KAFKA_SKIP_CUSTOM_CERT_VALIDATION KAFKA_CLIENT_KEYSTORE KAFKA_CLIENT_KEYSTORE_PASSWORD KAFKA_CLIENT_KEY_PASSWORD ENCRYPTED_KAFKA_CLIENT_KEYSTORE_PASSWORD ENCRYPTED_KAFKA_CLIENT_KEY_PASSWORD SECRET_ID CONNECTOR_URL CONNECTOR_TYPE CONNECTOR_CLASS_NAME], got KAFKA_SASL_MECHANISM

Reproduction Steps

Validate SASL types from https://docs.aws.amazon.com/sdk-for-go/api/service/glue/#Connection with ConnectionPropertyKey_Values()

Possible Solution

The connection properties from here: https://docs.aws.amazon.com/sdk-for-go/api/service/glue/#Connection seem more fleshed out than any of the AWS docs I've found, so if those types could be what the rest of the glue portions use that'd be great

Additional Information/Context

The documentation for glue connections isn't perfect from AWS, but these SASL types are valid, and I can make them via the console and cloudformation:

Resources:
  myGlueConnection:
    Type: 'AWS::Glue::Connection'
    Properties:
      CatalogId: !Ref 'AWS::AccountId'
      ConnectionInput:
        ConnectionProperties:
          KAFKA_BOOTSTRAP_SERVERS: 'boot.us-east-1.amazonaws.com:9098'
          KAFKA_SASL_MECHANISM: SCRAM-SHA-512
          SECRET_ID: test
          KAFKA_SSL_ENABLED: 'false'
        ConnectionType: KAFKA

SDK version used

1.19.3

Environment details (Version of Go (go version)? OS name and version, etc.)

Using Terraform downstream

RanVaknin commented 11 months ago

Hi @mforeman19 ,

Thanks for bringing this to our attention. It seems like the Glue service team updated their internal API model without a proper release. Because of that the SDK cannot generate the proper enum types.

I have cut an internal ticket to the service team. I will update you once the issue is addressed.

Thanks, Ran~

P94420029

RanVaknin commented 10 months ago

This should have been fixed. Please pull the latest version of the SDK.

Thanks! Ran~

github-actions[bot] commented 10 months ago

This issue is now closed.

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.