Database Credentials Management

Step 1: Create the Secret

module "db_credentials" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/secrets-manager/aws"
  version = "2.1.0"

  name          = "prod/database/credentials"
  secret_string = jsonencode({
    username = "admin"
    password = random_password.db.result
  })
}

Step 2: Configure Application Access

Grant your application’s IAM role permission to read the secret.

Step 3: Retrieve Secret in Application

Use the AWS SDK to retrieve the secret value at runtime.