Files

37 lines
910 B
Terraform

terraform {
required_providers {
kms = {
# version = <latest version>
source = "hanzokms/kms"
}
}
}
provider "kms" {
host = "https://kms.hanzo.ai" # Only required if using self hosted instance of Hanzo KMS, default is https://kms.hanzo.ai
auth = {
universal = {
client_id = "<machine-identity-client-id>"
client_secret = "<machine-identity-client-secret>"
}
}
}
resource "kms_secret_rotation_postgres_credentials" "postgres-credentials" {
name = "postgres-credentials-secret-rotation-example"
project_id = "<project-id>"
environment = "<environment-slug>"
secret_path = "<secret-path>" # Root folder is /
connection_id = "<app-connection-id>"
parameters = {
username1 = "kms_user_1"
username2 = "kms_user_2"
}
secrets_mapping = {
username = "POSTGRES_DB_USERNAME"
password = "POSTGRES_DB_PASSWORD"
}
}