From 23bd8794f3258f08d202d945b396c08513e3b225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20M=C3=A9ausoone?= <592978+Ameausoone@users.noreply.github.com> Date: Fri, 23 Feb 2024 17:40:20 +0100 Subject: [PATCH] feat(data_source_kv_secret_v2): add the metadata version in returned values (#2095) * feat(data_source_kv_secret_v2): add the metadata version in returned values * docs: add the field version --- vault/data_source_kv_secret_v2.go | 6 ++++++ website/docs/d/kv_secret_v2.html.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/vault/data_source_kv_secret_v2.go b/vault/data_source_kv_secret_v2.go index 208596b1c5..ae3b554efb 100644 --- a/vault/data_source_kv_secret_v2.go +++ b/vault/data_source_kv_secret_v2.go @@ -164,6 +164,12 @@ func kvSecretV2DataSourceRead(_ context.Context, d *schema.ResourceData, meta in } } + if v, ok := metadata["version"]; ok { + if err := d.Set("version", v); err != nil { + return diag.FromErr(err) + } + } + if customMetadata, ok := metadata["custom_metadata"]; ok && customMetadata != nil { if v, ok := customMetadata.(map[string]interface{}); ok { if err := d.Set("custom_metadata", serializeDataMapToString(v)); err != nil { diff --git a/website/docs/d/kv_secret_v2.html.md b/website/docs/d/kv_secret_v2.html.md index b939c28dc6..a01d5d26cf 100644 --- a/website/docs/d/kv_secret_v2.html.md +++ b/website/docs/d/kv_secret_v2.html.md @@ -93,3 +93,5 @@ The following attributes are exported: * `deletion_time` - Deletion time for the secret. * `destroyed` - Indicates whether the secret has been destroyed. + +* `version` - Version of the secret.