Skip to content

AWS SecretsManager JSON number value results in "unable to unmarshal secret" #510

@jtut1731

Description

@jtut1731

Describe the solution you'd like
If a secret contains a JSON number value, this value should be converted to a string value.

What is the added value?
AWS SecretsManager includes the ability to automatically rotate RDS credentials. The credentials secret that it creates include "port", and the value is a number in JSON.

AWS SecretManager Secret (JSON):

{
  "database": "my-db",
  "password": "%K>U~(_b.&RJs#xFE!P-B?tmWDp3JXcd",
  "masterarn": "arn:aws:secretsmanager:us-east-1:1234567890:secret:secretMySqlMasterUser-ABC-ABC",
  "engine": "mysql",
  "port": 3306,
  "dbInstanceIdentifier": "abc123",
  "host": "abc123.us-east-1.rds.amazonaws.com",
  "username": "my-db-user"
}

should produce Secret data:

  database: "my-db",
  password: "%K>U~(_b.&RJs#xFE!P-B?tmWDp3JXcd",
  masterarn: "arn:aws:secretsmanager:us-east-1:1234567890:secret:secretMySqlMasterUser-ABC-ABC",
  engine: "mysql",
  port: "3306",
  dbInstanceIdentifier: "abc123",
  host: "abc123.us-east-1.rds.amazonaws.com",
  username: "my-db-user"

Observations (Constraints, Context, etc):
In code: /pkg/provider/aws/secretsmanager/secretsmanager.go: 117
Error message: secret my-secret: json: cannot unmarshal number into Go value of type string

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions