ansible-collections / community.hashi_vault

Ansible collection for managing and working with HashiCorp Vault.
https://docs.ansible.com/ansible/devel/collections/community/hashi_vault/index.html
GNU General Public License v3.0
80 stars 59 forks source link

add content for KV get operations #246

Closed briantist closed 2 years ago

briantist commented 2 years ago
SUMMARY

Adding modules and lookups for KV get.

I started with a single vault_kv_get that would take a kv_version option to decide which KV version we're dealing with, but ultimately decided on separate modules/plugins for kv1 and kv2: both the inputs (options) and outputs (return data) are different, so trying to mix them doesn't make a lot of sense.

I have mulled over the possibility of a generic vault_kv_get in addition that could A) take a kv_version, B) read the mount point info from Vault to determine which KV version it is (extra round trip + requires permissions), or C) both (like kv_version could be 1, 2, or 'auto'). I am still not so sure this "generic" one is a good idea. I won't be implementing it in this PR, but if there's demand we'll have a public discussion about it.

ISSUE TYPE
COMPONENT NAME

vault_kv1_get (lookup & module) vault_kv2_get (lookup & module)

ADDITIONAL INFORMATION
github-actions[bot] commented 2 years ago

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and the docs are now incorporated into main: https://community-hashi-vault-main.surge.sh

codecov[bot] commented 2 years ago

Codecov Report

Merging #246 (a2c2c7a) into main (da6dded) will increase coverage by 0.44%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #246      +/-   ##
==========================================
+ Coverage   97.49%   97.94%   +0.44%     
==========================================
  Files          56       65       +9     
  Lines        2518     3060     +542     
  Branches      241      268      +27     
==========================================
+ Hits         2455     2997     +542     
  Misses         49       49              
  Partials       14       14              
Flag Coverage Δ
env_docker-default 97.94% <100.00%> (+0.44%) :arrow_up:
integration 81.89% <89.41%> (+1.34%) :arrow_up:
sanity 39.42% <43.91%> (+0.80%) :arrow_up:
target_ansible-doc 100.00% <100.00%> (ø)
target_auth_approle 89.47% <ø> (ø)
target_auth_aws_iam 50.00% <ø> (ø)
target_auth_cert 86.36% <ø> (ø)
target_auth_jwt 91.30% <ø> (ø)
target_auth_ldap 89.47% <ø> (ø)
target_auth_none 100.00% <ø> (ø)
target_auth_token 71.42% <ø> (ø)
target_auth_userpass 85.71% <ø> (ø)
target_connection_options 74.76% <ø> (ø)
target_controller 79.31% <98.47%> (+3.80%) :arrow_up:
target_filter_vault_login_token 77.77% <ø> (ø)
target_import 39.42% <43.91%> (+0.80%) :arrow_up:
target_lookup_hashi_vault 81.33% <ø> (ø)
target_lookup_vault_kv1_get 91.30% <91.30%> (?)
target_lookup_vault_kv2_get 91.11% <91.11%> (?)
target_lookup_vault_login 100.00% <ø> (ø)
target_lookup_vault_read 90.00% <ø> (ø)
target_lookup_vault_token_create 82.97% <ø> (ø)
target_lookup_vault_write 59.14% <ø> (ø)
target_module_utils 95.90% <ø> (ø)
target_module_vault_kv1_get 87.23% <87.23%> (?)
target_module_vault_kv2_get 86.95% <86.95%> (?)
target_module_vault_login 93.93% <ø> (ø)
target_module_vault_pki_generate_certificate 78.26% <ø> (ø)
target_module_vault_read 92.10% <ø> (ø)
target_module_vault_token_create 90.00% <ø> (ø)
target_module_vault_write 57.53% <ø> (ø)
target_modules 76.13% <96.41%> (+5.93%) :arrow_up:
units 94.41% <98.52%> (+0.91%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
plugins/doc_fragments/backend_mount.py 100.00% <100.00%> (ø)
plugins/lookup/vault_kv1_get.py 100.00% <100.00%> (ø)
plugins/lookup/vault_kv2_get.py 100.00% <100.00%> (ø)
plugins/modules/vault_kv1_get.py 100.00% <100.00%> (ø)
plugins/modules/vault_kv2_get.py 100.00% <100.00%> (ø)
tests/unit/plugins/lookup/test_vault_kv1_get.py 100.00% <100.00%> (ø)
tests/unit/plugins/lookup/test_vault_kv2_get.py 100.00% <100.00%> (ø)
tests/unit/plugins/modules/test_vault_kv1_get.py 100.00% <100.00%> (ø)
tests/unit/plugins/modules/test_vault_kv2_get.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update da6dded...a2c2c7a. Read the comment docs.

briantist commented 2 years ago

thanks for taking a look @felixfontein !