Chef cookbook names with hyphens and LWRP use

If you create a cookbook with a hyphen in the name such as my-cookbook, you’ll have a challenge using lightweight resource providers (LWRP’s) in the cookbook.  It turns out that hyphen is not allowed as a variable in ruby and under the covers, LWRP’s are managed with a variable name combination of the cookbookName_LWRPname.

To address this issue, chef converts the hyphen in the cookbook name to underscore.  You can use the LWRP if you know the secret.  You’ll use it by converting the hyphen in the name to underscore such as:

my_cookbook_LWRPname

voila

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s