Search code examples
chef-infraterminologyhistory

Are an LWRP and a Custom Resource the same thing?


I'm a little confused by these two pieces of Chef terminology. Lots of discussion of Chef online refers to LWRPs, or Lightweight Resource Providers. However, the official Chef docs barely use this term, and do not define it anywhere or have a page about LWRPs. They do, however, have a page about what they call Custom Resources, and there's what I guess was the URL of an old page at https://docs.chef.io/lwrp_custom_resource.html which now redirects to https://docs.chef.io/custom_resources.html.

Are "LWRP" and "Custom Resource" just different terms for the same concept, or do they have different meanings? If they're different things, do LWRPs still exist, or are they an obsolete construct that's been removed from Chef?


Solution

  • Yes, we stopped using the term "LWRP" because we felt it was overly confusing and didn't emphasize that resources are the same, no matter if they come from Chef core or a cookbook. There are two major "styles" for writing custom resources, one is the LWRP-DSL style in the resources/ and providers/ cookbook directories, and the other is the plain-old-Ruby style in libraries/. But no matter how you write a resource, they are all the same under the hood.