简体   繁体   中英

How do I include a custom inspec resource in multiple profiles?

I have written a custom chef inspec resource to work with a proprietary configuration format that the company I work for uses. I have put the resource in the .\\myprofile\\libraries folder as the documentation dictates that I should[1]. However, I want to use this resource in multiple profiles without copy/pasting the same resource or symlinking the resource (I'm developing on Windows). Is there a way I can define this resource in a single location and then reference it in multiple profiles?

[1] https://www.inspec.io/docs/reference/dsl_resource/

You can create a profile with your custom resource defined there. I would suggest some profile without any controls, or with minimum amount of controls, which all depend on your custom resource.

Then in the other profiles, where you need your custom resource you can reference your fist profile in inspec.yml :

depends:
- name: my_profile_with_custom_resource
  path: ../relative/path

Inplace of path can be an url or a absolute path or git url (with branch and tags). By default all the controls and custom resources defined in my_profile_with_custom_resource will be available in the new profile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM