Skip to content

Instantly share code, notes, and snippets.

@mikaelkrief
Created February 11, 2019 12:39
Show Gist options
  • Save mikaelkrief/0299b1eed9e0440cf2c87b3d57fd695e to your computer and use it in GitHub Desktop.
Save mikaelkrief/0299b1eed9e0440cf2c87b3d57fd695e to your computer and use it in GitHub Desktop.
control 'azurerm_virtual_machine' do
describe azurerm_virtual_machine(resource_group: 'MyResourceGroup', name: 'prod-web-01') do
it { should exist }
it { should have_monitoring_agent_installed }
it { should have_only_approved_extensions(['MicrosoftMonitoringAgent']) }
its('type') { should eq 'Microsoft.Compute/virtualMachines' }
its('installed_extensions_types') { should include('MicrosoftMonitoringAgent') }
its('installed_extensions_names') { should include('LogAnalytics') }
its('properties.location') { should eq 'northeurope'}
its('properties.hardwareProfile.vmSize') { should eq 'Standard_Ds1_V2'}
its('properties.storageProfile.osDisk.osType') { should eq 'Linux' }
its('properties.storageProfile.dataDisks.count') { should eq 1 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment