hashicorp / terraform-provider-vault

Terraform Vault provider
https://www.terraform.io/docs/providers/vault/
Mozilla Public License 2.0
467 stars 542 forks source link

db/postgres: Add support for inline TLS config #2339

Closed fairclothjm closed 1 month ago

fairclothjm commented 1 month ago

This PR adds support for the inline TLS fields in the postgres database plugin added in Vault 1.18.

Example usage:

provider "vault" {
}

terraform {
  required_providers {
    vault = {
      source = "hashicorp/vault"
      version = "~> 4.2.0"
    }
  }
}

resource "vault_mount" "db" {
  path = "db"
  type = "database"
}

resource "vault_database_secret_backend_connection" "test" {
  backend = vault_mount.db.path
  name = "postgres"

  postgresql {
    connection_url = "postgresql://{{username}}:{{password}}@localhost:5432/postgres?sslmode=verify-full"
    username       = "client"

    tls_ca          = file("../out/ca.crt")
    tls_certificate = file("../out/client.crt")
    private_key     = file("../out/client.key")
  }
}