InSpec provides a mechanism for defining custom resources. These become available with their respective names and provide easy functionality to profiles.
Resources are written as a regular Ruby `class` which inherits from `Inspec.resource`. The number (`1`) specifies the version this resource plugin targets. As InSpec evolves, this interface may change and may require a higher version.
The following attributes can be configured:
*`name` - Identifier of the resource (required)
*`desc` - Description of the resource (optional)
*`example` - Example usage of the resource (optional)
The following methods are available to the resource:
*`inspec` - Contains a registry of all other resources to interact with the operating system or target in general.
*`skip_resource` - A resource may call this method to indicate, that requirements aren't met. All tests that use this resource will be marked as `skipped`.
The following example shows a full resource using attributes and methods to provide simple access to a configuration file: