Files
terraform-provider/docs/resources/secret_rotation_postgres_credentials.md

3.5 KiB

page_title, subcategory, description
page_title subcategory description
kms_secret_rotation_postgres_credentials Resource - terraform-provider Secret Rotations Create and manage PostgreSQL Credentials Secret Rotations

kms_secret_rotation_postgres_credentials (Resource)

Create and manage PostgreSQL Credentials Secret Rotations

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

Schema

Required

  • connection_id (String) The ID of the connection to use for the secret rotation.
  • environment (String) The slug of the project environment to rotate secrets from.
  • name (String) The name of the secret rotation.
  • parameters (Attributes) Parameters to modify how secrets are rotated. (see below for nested schema)
  • project_id (String) The ID of the Hanzo KMS project to create the secret rotation in.
  • secret_path (String) The folder path to rotate secrets from.
  • secrets_mapping (Attributes) Secret mappings to modify how secrets are rotated. (see below for nested schema)

Optional

  • auto_rotation_enabled (Boolean) Whether secrets should be automatically rotated.
  • description (String) The description of the secret rotation.
  • rotate_at_utc (Attributes) At which UTC time the rotation should occur. (see below for nested schema)
  • rotation_interval (Number) How many days to wait between each rotation.
  • temporary_parameters (Attributes) Temporary parameters to modify how secrets are rotated. (see below for nested schema)

Read-Only

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

Nested Schema for parameters

Required:

  • username1 (String) The username of the first login to rotate passwords for. This user must already exists in your database.
  • username2 (String) The username of the second login to rotate passwords for. This user must already exists in your database.

Nested Schema for secrets_mapping

Required:

  • password (String) The name of the secret that the generated password will be mapped to.
  • username (String) The name of the secret that the active username will be mapped to.

Nested Schema for rotate_at_utc

Optional:

  • hours (Number) The hour at which the rotation should occur (UTC).
  • minutes (Number) The minute at which the rotation should occur (UTC).

Nested Schema for temporary_parameters