vault_kv_secret_v2

Reads a KV-V2 secret from a given path in Vault.

This resource is primarily intended to be used with Vault's KV-V2 secret backend.

Example Usage

resource "vault_mount" "kvv2" {
  path        = "kvv2"
  type        = "kv"
  options     = { version = "2" }
  description = "KV Version 2 secret engine mount"
}

resource "vault_kv_secret_v2" "example" {
  mount               = vault_mount.kvv2.path
  name                = "secret"
  cas                 = 1
  delete_all_versions = true
  data_json = jsonencode(
    {
      zip = "zap",
      foo = "bar"
    }
  )
}

data "vault_kv_secret_v2" "example" {
  mount = vault_mount.kvv2.path
  name  = vault_kv_secret_v2.example.name
}

Argument Reference

The following arguments are supported:

Required Vault Capabilities

Use of this resource requires the read capability on the given path.

Attributes Reference

The following attributes are exported: