Skip to content

Commit

Permalink
feat(data_source_kv_secret_v2): add the metadata version in returned …
Browse files Browse the repository at this point in the history
…values (#2095)

* feat(data_source_kv_secret_v2): add the metadata version in returned values

* docs: add the field version
  • Loading branch information
Ameausoone authored Feb 23, 2024
1 parent 2c10333 commit 23bd879
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vault/data_source_kv_secret_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/kv_secret_v2.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 23bd879

Please sign in to comment.