sous-chefs / consul

Development repository for the consul cookbook
https://supermarket.chef.io/cookbooks/consul
Apache License 2.0
192 stars 244 forks source link

What happened with the consul data bag? #369

Closed isuftin closed 7 years ago

isuftin commented 7 years ago

Looking at this: https://github.com/johnbellone/consul-cookbook/pull/98

In the latest 2.2.0 tag, this is nowhere to be found and I can't find any chatter discussing the removal of this. So are we not using a data bag for the encrypt attribute and tokens?

legal90 commented 7 years ago

Hi @isuftin, The integrated support of data bags has been removed when custom resources (like consul_config) were implemented: https://github.com/johnbellone/consul-cookbook/issues/238#issuecomment-193529717

The recommended way is managing data bags on the upper level, in wrapper cookbook. For example:

# wrapper_recipe.rb
consul_data = data_bag_item('apps', 'consul')

config = consul_config node['consul']['service_name'] do |r|
  node['consul']['config'].each_pair { |k, v| r.send(k, v) }

  owner node['consul']['service_user']
  group node['consul']['service_group']
  encrypt consul_data['encrypt']   # <== Here we pass the secret data
  notifies :reload, "consul_service[#{node['consul']['service_name']}]", :delayed
end

E.q. you should not include consul::default recipe here, but feel free to use our resources in any way you want :)

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.