Can an AWS Secret be associated with a AWS Glue connection using Terraform?


In the AWS Glue Documentation I found that

We can use Secrets Manager to let AWS Glue access your secret at runtime
Storing connection credentials in AWS Secrets Manager - AWS Glue

I have a Glue connection defined like this:

resource "aws_glue_connection" "example" {
  connection_properties = {
    JDBC_CONNECTION_URL = "jdbc:mysql://"
    PASSWORD            = "examplepassword"
    USERNAME            = "exampleusername"

But if I check the connection in AWS Glue Catalog, I can see the username there.
So, the Glue connection created via Terraform is not associated with the Secret. At least this is how Glue Catalog sees them.
If the Glue Connection was associated with the secret, the Username shouldn’t have been visible in Glue Catalog.

Is it possible to create a Glue connection from Terraform that can retrieve the user and password at runtime from Secrets Manager, not at deploy?

Thank you!

You should be able to use SECRET_ID in the connection_properties for your example. The SECRET_ID can be the name of the secret which has the credentials.