Files

39 lines
906 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_dynamic_secret_mongo_db" "mongo-db" {
name = "mongo-db-dynamic-secret-example"
project_slug = "your-project-slug"
environment_slug = "dev"
path = "/"
default_ttl = "1h"
max_ttl = "24h"
configuration = {
host = "your-host"
port = 27017
username = "your-username"
password = "your-password"
database = "default"
roles = ["readWrite"]
}
username_template = "{{randomUsername}}"
}