Hello,
Would like to store & retrieve sensitive data in encrypted databags using chef vault option.
This is how I went about... am I forgetting something?
- I created the databags on my workstation
knife vault create decd_vault ucdagent_TST '{"username":"userdecd", "password":"***"}' -S "role:prd_vra_ucdagent" -A "admin" -M client
In Chef Manage, the databags are visible
item_keys contains the key for the server where I want to run my cookbook
However, when I tryknife vault show ucdagent_TST
on workstation, I getdata bag ucdagent_TST is not a chef-vault
- cookbook code to read the databag
fqdn = node['fqdn'].downcase
#decd_databag = Chef::DataBagItem.load("decd_vault","ucdagent_#{node['ucdagent']['env']}")
decd_databag_keys = Chef::DataBagItem.load("decd_vault","ucdagent_#{node['ucdagent']['env']}_keys")
key = decd_databag_keys[fqdn]
decd_vault = Chef::EncryptedDataBagItem.load("decd_vault", "ucdagent_#{node['ucdagent']['env']}", key)
- Error on last line while running the cookbook
Recipe Compile Error in C:/chef/cache/cookbooks/VRA_ucdagent/recipes/default.rb
=================================================================
Chef::EncryptedDataBagItem::DecryptionFailure
=================================================================
Error decrypting data bag value: ''. Most likely the provided key is incorrect.
Workstation chef version
ChefDK version: 4.3.13
Chef Infra Client version: 15.2.20
chef-client version on decrypting host
Chef: 12.12.13
Any help appreciated