fix a problem with variable scoping.

It's possible that this was introduced in chef 12, but I'm getting errors when using the x509 resource saying:

NoMethodError: undefined method `cert' for Chef::Resource::File
and
NoMethodError: undefined method `key' for Chef::Resource::File

The problem is that inside the file resource, self refers to the file resource itself, so we need locally scoped variables to hold the data it needs.