Skip to content

Instantly share code, notes, and snippets.

@CsBigDataHub
Forked from mikaelkrief/vm.rb
Created July 14, 2021 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CsBigDataHub/40ee22952c32715ca21d9eef2c64d079 to your computer and use it in GitHub Desktop.
Save CsBigDataHub/40ee22952c32715ca21d9eef2c64d079 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