mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
Add InSpec init profile folder for Azure.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
This commit is contained in:
parent
dcb141da79
commit
a337ca1d23
4 changed files with 85 additions and 0 deletions
56
lib/plugins/inspec-init/templates/profiles/azure/README.md
Normal file
56
lib/plugins/inspec-init/templates/profiles/azure/README.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Example InSpec Profile For Azure
|
||||
|
||||
This example shows the implementation of an InSpec profile for Azure. See [https://github.com/inspec/inspec-azure](https://github.com/inspec/inspec-azure) for details on how to configure credentials for your subscription.
|
||||
|
||||
## Create a profile
|
||||
|
||||
```
|
||||
$ inspec init profile --platform azure my-profile
|
||||
|
||||
─────────────────────────── InSpec Code Generator ───────────────────────────
|
||||
|
||||
Creating new profile at /Users/spaterson/my-profile
|
||||
• Creating directory libraries
|
||||
• Creating file README.md
|
||||
• Creating directory controls
|
||||
• Creating file controls/example.rb
|
||||
• Creating file inspec.yml
|
||||
• Creating file libraries/.gitkeep
|
||||
|
||||
```
|
||||
|
||||
## Run the tests
|
||||
|
||||
```
|
||||
$ cd my-profile/
|
||||
$ inspec exec . -t azure://
|
||||
|
||||
|
||||
Profile: Azure InSpec Profile (my-profile)
|
||||
Version: 0.1.0
|
||||
Target: azure://12345abc-987d-654e-fg21-abcdef23324r
|
||||
|
||||
× azure-virtual-machines-exist-check: Check resource groups to see if any VMs exist. (4 failed)
|
||||
× Azure Virtual Machines should exist
|
||||
expected Azure Virtual Machines to exist
|
||||
× Azure Virtual Machines should exist
|
||||
expected Azure Virtual Machines to exist
|
||||
× Azure Virtual Machines should exist
|
||||
expected Azure Virtual Machines to exist
|
||||
× Azure Virtual Machines should exist
|
||||
expected Azure Virtual Machines to exist
|
||||
✔ Azure Virtual Machines should exist
|
||||
✔ Azure Virtual Machines should exist
|
||||
✔ Azure Virtual Machines should exist
|
||||
|
||||
|
||||
Profile: Azure Resource Pack (inspec-azure)
|
||||
Version: 1.2.0
|
||||
Target: azure://12345abc-987d-654e-fg21-abcdef23324r
|
||||
|
||||
No tests executed.
|
||||
|
||||
Profile Summary: 0 successful controls, 1 control failure, 0 controls skipped
|
||||
Test Summary: 3 successful, 4 failures, 0 skipped
|
||||
|
||||
```
|
|
@ -0,0 +1,15 @@
|
|||
# encoding: utf-8
|
||||
# copyright: 2018, The Authors
|
||||
|
||||
title 'Sample Section'
|
||||
|
||||
# you add controls here
|
||||
control 'azure-virtual-machines-exist-check' do # A unique ID for this control.
|
||||
impact 1.0 # The criticality, if this control fails.
|
||||
title 'Check resource groups to see if any VMs exist.' # A human-readable title
|
||||
azurerm_resource_groups.names.each do |resource_group_name| # Plural resources can be leveraged to loop across many resources
|
||||
describe azurerm_virtual_machines(resource_group: resource_group_name) do
|
||||
it { should exist } # The test itself.
|
||||
end
|
||||
end
|
||||
end
|
14
lib/plugins/inspec-init/templates/profiles/azure/inspec.yml
Normal file
14
lib/plugins/inspec-init/templates/profiles/azure/inspec.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: <%= name %>
|
||||
title: Azure InSpec Profile
|
||||
maintainer: The Authors
|
||||
copyright: The Authors
|
||||
copyright_email: you@example.com
|
||||
license: Apache-2.0
|
||||
summary: An InSpec Compliance Profile For Azure
|
||||
version: 0.1.0
|
||||
inspec_version: '>= 3.7'
|
||||
depends:
|
||||
- name: inspec-azure
|
||||
url: https://github.com/inspec/inspec-azure/archive/master.tar.gz
|
||||
supports:
|
||||
- platform: azure
|
Loading…
Reference in a new issue