Would this sufficiently guard from error, in your case?

```ruby
certificate_manage 'gitlab' do
  search_id node['gitlab']['certificate_databag_id'] 
  cert_path '/etc/nginx/ssl'
  owner node['gitlab']['user']
  group node['gitlab']['user']
  nginx_cert true
  not_if { node['gitlab']['certificate_databag_id'].nil? }
  only_if { node['gitlab']['https'] }
end
```