Files

2.9 KiB

page_title, subcategory, description
page_title subcategory description
kms_dynamic_secret_mongo_db Resource - terraform-provider Dynamic Secrets Create and manage MongoDB Dynamic Secret

kms_dynamic_secret_mongo_db (Resource)

Create and manage MongoDB Dynamic Secret

Example Usage

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}}"
}

Schema

Required

  • configuration (Attributes) The configuration of the dynamic secret (see below for nested schema)
  • default_ttl (String) The default TTL that will be applied for all the leases.
  • environment_slug (String) The slug of the environment to create the dynamic secret in.
  • name (String) The name of the dynamic secret.
  • path (String) The path to create the dynamic secret in.
  • project_slug (String) The slug of the project to create dynamic secret in.

Optional

  • max_ttl (String) The maximum limit a TTL can be leased or renewed for.
  • metadata (Attributes Set) The metadata associated with this dynamic secret (see below for nested schema)
  • username_template (String) The username template of the dynamic secret

Read-Only

  • id (String) The ID of the dynamic secret.

Nested Schema for configuration

Required:

  • database (String) The name of the database to use.
  • host (String) The host of the database server.
  • password (String, Sensitive) The password to use to connect to the database.
  • roles (List of String) A list of role names to assign to the user. The role names can either be built-in or custom.
  • username (String) The username to use to connect to the database.

Optional:

  • ca (String) The CA certificate to use to connect to the database.
  • port (Number) The port of the database server.

Nested Schema for metadata

Required:

  • key (String) The key of the metadata object
  • value (String) The value of the metadata object