Best not to use "rescue" if you need to guard against nil. Rather, write two guards:

```ruby
not_if { node['cloud'].nil? }
only_if { node['cloud']['provider'] == 'ec2' }
```

You might need to play with that a bit to see if the only_if will also get executed if the not_if guards against the resource being added at all.