Skip to main content

CustomResourceWithAttributes

The department is: CustomResourceWithAttributes

The full name of the cop is: Chef/Modernize/CustomResourceWithAttributes

Enabled by default Supports autocorrection Target Chef Version
Enabled Yes All Versions

In HWRPs and LWRPs you defined attributes, but custom resources changed the name to be properties to avoid confusion with chef recipe attributes. When writing a custom resource they should be called properties even though the two are aliased.

Examples

incorrect

attribute :something, String

action :create do
  # some action code because we're in a custom resource
end

correct

property :something, String

action :create do
  # some action code because we're in a custom resource
end

Configurable attributes

Name Default value Configurable values
Version Added 5.2.0 String
Include
  • **/resources/*.rb
Array

Was this page helpful?

×









Search Results