From 3cc40288a6c58ecb2f023acf51eab18aba8fcd1a Mon Sep 17 00:00:00 2001 From: Sathish Date: Sun, 19 Dec 2021 09:25:29 +0530 Subject: [PATCH 1/6] support SQL VM Group Availability Listener(s) Signed-off-by: Sathish --- ...ual_machine_group_availability_listener.rb | 24 +++++++++++++ ...al_machine_group_availability_listeners.rb | 35 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 libraries/azure_sql_virtual_machine_group_availability_listener.rb create mode 100644 libraries/azure_sql_virtual_machine_group_availability_listeners.rb diff --git a/libraries/azure_sql_virtual_machine_group_availability_listener.rb b/libraries/azure_sql_virtual_machine_group_availability_listener.rb new file mode 100644 index 000000000..46be2a3ba --- /dev/null +++ b/libraries/azure_sql_virtual_machine_group_availability_listener.rb @@ -0,0 +1,24 @@ +require 'azure_generic_resource' + +class AzureSQLVirtualMachineGroupAvailabilityListener < AzureGenericResource + name 'azure_sql_virtual_machine_group_availability_listener' + desc 'Retrieves and verifies the settings of an Azure SQL Virtual Machine Group Availability Listener.' + example <<-EXAMPLE + describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'inspec-def-rg', sql_virtual_machine_group_name: 'inspec-sql-vm-group', name: 'inspec-avl') do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups', opts) + opts[:required_parameters] = %i(sql_virtual_machine_group_name) + opts[:resource_path] = "#{opts[:sql_virtual_machine_group_name]}/availabilityGroupListeners" + super(opts, true) + end + + def to_s + super(AzureSQLVirtualMachineGroupAvailabilityListener) + end +end diff --git a/libraries/azure_sql_virtual_machine_group_availability_listeners.rb b/libraries/azure_sql_virtual_machine_group_availability_listeners.rb new file mode 100644 index 000000000..6f136de64 --- /dev/null +++ b/libraries/azure_sql_virtual_machine_group_availability_listeners.rb @@ -0,0 +1,35 @@ +require 'azure_generic_resources' + +class AzureSQLVirtualMachineGroupAvailabilityListeners < AzureGenericResources + name 'azure_sql_virtual_machine_group_availability_listeners' + desc 'Verifies settings for a collection of Azure SQL Virtual Machine Group Availability Listeners' + example <<-EXAMPLE + describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'inspec-def-rg', sql_virtual_machine_group_name: 'inspec-sql-vm-group') do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups', opts) + opts[:required_parameters] = %i(sql_virtual_machine_group_name) + opts[:resource_path] = "#{opts[:sql_virtual_machine_group_name]}/availabilityGroupListeners" + super(opts, true) + return if failed_resource? + + populate_filter_table_from_response + end + + def to_s + super(AzureSQLVirtualMachineGroupAvailabilityListeners) + end + + private + + def populate_table + @resources.each do |resource| + @table << resource.merge(resource[:properties]) + end + end +end From 9b0337fe0b4ccb353d25576bda99fe787eed3a87 Mon Sep 17 00:00:00 2001 From: Sathish Date: Sun, 19 Dec 2021 09:25:38 +0530 Subject: [PATCH 2/6] unit test SQL VM Group Availability Listener(s) Signed-off-by: Sathish --- ...achine_group_availability_listener_test.rb | 17 +++++++++++++++ ...chine_group_availability_listeners_test.rb | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/unit/resources/azure_sql_virtual_machine_group_availability_listener_test.rb create mode 100644 test/unit/resources/azure_sql_virtual_machine_group_availability_listeners_test.rb diff --git a/test/unit/resources/azure_sql_virtual_machine_group_availability_listener_test.rb b/test/unit/resources/azure_sql_virtual_machine_group_availability_listener_test.rb new file mode 100644 index 000000000..dfd4902d8 --- /dev/null +++ b/test/unit/resources/azure_sql_virtual_machine_group_availability_listener_test.rb @@ -0,0 +1,17 @@ +require_relative 'helper' +require 'azure_sql_virtual_machine_group_availability_listener' + +class AzureSQLVirtualMachineGroupAvailabilityListenerConstructorTest < Minitest::Test + def test_empty_param_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListener.new } + end + + # resource_provider should not be allowed. + def test_resource_provider_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListener.new(resource_provider: 'some_type') } + end + + def test_resource_group_name_alone_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListener.new(resource_group: 'test') } + end +end diff --git a/test/unit/resources/azure_sql_virtual_machine_group_availability_listeners_test.rb b/test/unit/resources/azure_sql_virtual_machine_group_availability_listeners_test.rb new file mode 100644 index 000000000..5300f867b --- /dev/null +++ b/test/unit/resources/azure_sql_virtual_machine_group_availability_listeners_test.rb @@ -0,0 +1,21 @@ +require_relative 'helper' +require 'azure_sql_virtual_machine_group_availability_listeners' + +class AzureSQLVirtualMachineGroupAvailabilityListenersConstructorTest < Minitest::Test + # resource_type should not be allowed. + def test_resource_type_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListeners.new(resource_provider: 'some_type') } + end + + def tag_value_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListeners.new(tag_value: 'some_tag_value') } + end + + def tag_name_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListeners.new(tag_name: 'some_tag_name') } + end + + def test_name_not_ok + assert_raises(ArgumentError) { AzureSQLVirtualMachineGroupAvailabilityListeners.new(name: 'some_name') } + end +end From 0fe2b8a4961b7dbb76a4d4cac9d9ba8d551e4e32 Mon Sep 17 00:00:00 2001 From: Sathish Date: Sun, 19 Dec 2021 09:25:46 +0530 Subject: [PATCH 3/6] integral test SQL VM Group Availability Listener(s) Signed-off-by: Sathish --- ...re_sql_virtual_machine_group_availability_listener.rb | 9 +++++++++ ...e_sql_virtual_machine_group_availability_listeners.rb | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listener.rb create mode 100644 test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listeners.rb diff --git a/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listener.rb b/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listener.rb new file mode 100644 index 000000000..68a09231c --- /dev/null +++ b/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listener.rb @@ -0,0 +1,9 @@ +rg = input(:resource_group, value: '') + +control 'Verify the settings of an SQL VM Availability listener' do + describe azure_sql_virtual_machine_group_availability_listener(resource_group: rg, sql_virtual_machine_group_name: 'inspec-sql-vm-group', name: 'inspec-avl') do + it { should exist } + its('type') { should eq 'Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/availabilityGroupListeners' } + its('properties.provisioningState') { should eq ' Succeeded' } + end +end diff --git a/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listeners.rb b/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listeners.rb new file mode 100644 index 000000000..c65f3534a --- /dev/null +++ b/test/integration/verify/controls/azure_sql_virtual_machine_group_availability_listeners.rb @@ -0,0 +1,9 @@ +rg = input(:resource_group, value: '') + +control 'Verify the settings of a collection of all SQL VM Availability listeners' do + describe azure_sql_virtual_machine_group_availability_listeners(resource_group: rg, sql_virtual_machine_group_name: 'inspec-sql-vm-group') do + it { should exist } + its('types') { should include 'Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/availabilityGroupListeners' } + its('provisioningStates') { should include ' Succeeded' } + end +end From 8a83dbb4e244d7b682eb48e827d48eef674b71a4 Mon Sep 17 00:00:00 2001 From: Sathish Date: Sun, 19 Dec 2021 09:25:59 +0530 Subject: [PATCH 4/6] document SQL VM Group Availability Listener(s) Signed-off-by: Sathish --- ...ual_machine_group_availability_listener.md | 98 +++++++++++++++++++ ...al_machine_group_availability_listeners.md | 95 ++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 docs/resources/azure_sql_virtual_machine_group_availability_listener.md create mode 100644 docs/resources/azure_sql_virtual_machine_group_availability_listeners.md diff --git a/docs/resources/azure_sql_virtual_machine_group_availability_listener.md b/docs/resources/azure_sql_virtual_machine_group_availability_listener.md new file mode 100644 index 000000000..b82e4945b --- /dev/null +++ b/docs/resources/azure_sql_virtual_machine_group_availability_listener.md @@ -0,0 +1,98 @@ +--- +title: About the azure_sql_virtual_machine_group_availability_listener Resource +platform: azure +--- + +# azure_sql_virtual_machine_group_availability_listener + +Use the `azure_sql_virtual_machine_group_availability_listener` InSpec audit resource to test properties related to an Azure SQL Virtual Machine Group Availability Listener. + +## Azure REST API version, endpoint and http client parameters + +This resource interacts with api versions supported by the resource provider. +The `api_version` can be defined as a resource parameter. +If not provided, the latest version will be used. +For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. +For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). +For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +`name`, `sql_virtual_machine_group_name` & `resource_group` is a required parameter. + +```ruby +describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do + it { should exist } + its('type') { should eq 'Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/availabilityGroupListeners' } +end +``` + +```ruby +describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do + it { should exist } +end +``` +## Parameters + +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| name | Name of the Azure SQL Virtual Machine Group Availability Listeners to test. | +| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | +| sql_virtual_machine_group_name | AQL Virtual Machine Group Name | + +The parameter set should be provided for a valid query: +- `resource_group`, `sql_virtual_machine_group_name` and `name` + +## Properties + +| Property | Description | +|--------------------------|------------------------------------------------------------------| +| id | Resource Id. | +| name | Resource name. | +| type | Resource type. `Microsoft.ServiceFabricMesh/applications` | +| properties | The properties of the SQL Virtual Machine Group Availability Listener. | +| properties.provisioningState | State of the resource. | + + +For properties applicable to all resources, such as `type`, `name`, `id`, `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). + +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/servicefabric/sfmeshrp-api-application_get) for other properties available. + +## Examples + +### Test that the SQL Virtual Machine Group Availability Listener is provisioned successfully. + +```ruby +describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do + its('properties.provisioningState') { should eq 'Succeeded' } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](/inspec/matchers/). + +### exists + +```ruby +# If a SQL Virtual Machine Group Availability Listener is found it will exist +describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do + it { should exist } +end +# if SQL Virtual Machine Group Availability Listener is not found it will not exist +describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do + it { should_not exist } +end +``` + +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file diff --git a/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md b/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md new file mode 100644 index 000000000..9bdf65942 --- /dev/null +++ b/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md @@ -0,0 +1,95 @@ +--- +title: About the azure_sql_virtual_machine_group_availability_listeners Resource +platform: azure +--- + +# azure_sql_virtual_machine_group_availability_listeners + +Use the `azure_sql_virtual_machine_group_availability_listeners` InSpec audit resource to test properties related to all Azure SQL Virtual Machine Group Availability Listeners. + +## Azure REST API version, endpoint and http client parameters + +This resource interacts with api versions supported by the resource provider. +The `api_version` can be defined as a resource parameter. +If not provided, the latest version will be used. +For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. +For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). +For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +An `azure_sql_virtual_machine_group_availability_listeners` resource block returns all Azure SQL Virtual Machine Group Availability Listeners. + +```ruby +describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do + #... +end +``` + +## Parameters +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | +| sql_virtual_machine_group_name | AQL Virtual Machine Group Name | + +The parameter set should be provided for a valid query: +- `resource_group` && `sql_virtual_machine_group_name` + +## Properties + +|Property | Description | Filter Criteria* | +|--------------------------------|------------------------------------------------------------------------|------------------| +| ids | A list of resource IDs. | `id` | +| names | A list of resource Names. | `name` | +| types | A list of the resource types. | `type` | +| properties | A list of Properties for all the SQL Virtual Machine Group Availability Listeners. | `properties` | +| provisioningStates | A list of provisioning states of the SQL Virtual Machine Group Availability Listeners. | `provisioningState`| + +* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). + +## Examples + +### Loop through SQL Virtual Machine Group Availability Listeners by their names. + +```ruby +azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME').names.each do |name| + describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: name) do + it { should exist } + end +end +``` +### Test that there are SQL Virtual Machine Group Availability Listeners that are successfully provisioned. + +```ruby +describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME').where(provisioningState: 'Succeeded') do + it { should exist } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). + +### exists + +```ruby +# Should not exist if no SQL Virtual Machine Group Availability Listeners are present +describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do + it { should_not exist } +end +# Should exist if the filter returns at least one SQL Virtual Machine Group Availability Listeners +describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do + it { should exist } +end +``` +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file From 11b8f55ac1361cd86242d8e7eefd7631fc235f86 Mon Sep 17 00:00:00 2001 From: Sathish Date: Sun, 19 Dec 2021 09:26:14 +0530 Subject: [PATCH 5/6] update readme with SQL VM Group Availability Listener(s) Signed-off-by: Sathish --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 978db0c04..8fc65eb26 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,8 @@ The following is a list of static resources. - [azure_sql_servers](https://docs.chef.io/inspec/resources/azure_sql_servers/) - [azure_sql_virtual_machine](https://docs.chef.io/inspec/resources/azure_sql_virtual_machine.md) - [azure_sql_virtual_machines](https://docs.chef.io/inspec/resources/azure_sql_virtual_machines.md) +- [azure_sql_virtual_machine_group_availability_listener](https://docs.chef.io/inspec/resources/azure_sql_virtual_machine_group_availability_listener.md) +- [azure_sql_virtual_machine_group_availability_listeners](https://docs.chef.io/inspec/resources/azure_sql_virtual_machine_group_availability_listeners.md) - [azure_storage_account](https://docs.chef.io/inspec/resources/azure_storage_account/) - [azure_storage_accounts](https://docs.chef.io/inspec/resources/azure_storage_accounts/) - [azure_storage_account_blob_container](https://docs.chef.io/inspec/resources/azure_storage_account_blob_container/) From a6d06eeaa81dd0026e72cc5e056aacb4ec169d30 Mon Sep 17 00:00:00 2001 From: Ian Maddaus Date: Mon, 7 Feb 2022 12:55:35 -0500 Subject: [PATCH 6/6] Docs edits Signed-off-by: Ian Maddaus --- ...ual_machine_group_availability_listener.md | 36 ++++++++++--------- ...al_machine_group_availability_listeners.md | 35 +++++++++--------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/docs/resources/azure_sql_virtual_machine_group_availability_listener.md b/docs/resources/azure_sql_virtual_machine_group_availability_listener.md index b82e4945b..2233036d2 100644 --- a/docs/resources/azure_sql_virtual_machine_group_availability_listener.md +++ b/docs/resources/azure_sql_virtual_machine_group_availability_listener.md @@ -5,7 +5,7 @@ platform: azure # azure_sql_virtual_machine_group_availability_listener -Use the `azure_sql_virtual_machine_group_availability_listener` InSpec audit resource to test properties related to an Azure SQL Virtual Machine Group Availability Listener. +Use the `azure_sql_virtual_machine_group_availability_listener` InSpec audit resource to test properties related to an Azure SQL virtual machine group availability listener. ## Azure REST API version, endpoint and http client parameters @@ -26,8 +26,6 @@ For an example `inspec.yml` file and how to set up your Azure credentials, refer ## Syntax -`name`, `sql_virtual_machine_group_name` & `resource_group` is a required parameter. - ```ruby describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do it { should exist } @@ -40,25 +38,29 @@ describe azure_sql_virtual_machine_group_availability_listener(resource_group: ' it { should exist } end ``` + ## Parameters -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| name | Name of the Azure SQL Virtual Machine Group Availability Listeners to test. | -| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | -| sql_virtual_machine_group_name | AQL Virtual Machine Group Name | +`name` _(required)_ + +Name of the Azure SQL virtual machine group availability listeners to test. + +`resource_group` _(required)_ + +Azure resource group that the targeted resource resides in. + +`sql_virtual_machine_group_name` _(required)_ -The parameter set should be provided for a valid query: -- `resource_group`, `sql_virtual_machine_group_name` and `name` +The Azure SQL virtual machine group name ## Properties | Property | Description | |--------------------------|------------------------------------------------------------------| -| id | Resource Id. | +| id | Resource ID. | | name | Resource name. | -| type | Resource type. `Microsoft.ServiceFabricMesh/applications` | -| properties | The properties of the SQL Virtual Machine Group Availability Listener. | +| type | Resource type. | +| properties | The properties of the SQL virtual machine group availability listener. | | properties.provisioningState | State of the resource. | @@ -68,7 +70,7 @@ Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/s ## Examples -### Test that the SQL Virtual Machine Group Availability Listener is provisioned successfully. +### Test that the SQL virtual machine group availability listener is provisioned successfully. ```ruby describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do @@ -83,11 +85,11 @@ This InSpec audit resource has the following special matchers. For a full list o ### exists ```ruby -# If a SQL Virtual Machine Group Availability Listener is found it will exist +# If a SQL virtual machine group availability listener is found it will exist describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do it { should exist } end -# if SQL Virtual Machine Group Availability Listener is not found it will not exist +# if SQL virtual machine group availability listener is not found it will not exist describe azure_sql_virtual_machine_group_availability_listener(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME', name: 'AVAILABILITY_LISTENER_NAME') do it { should_not exist } end @@ -95,4 +97,4 @@ end ## Azure Permissions -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. diff --git a/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md b/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md index 9bdf65942..c1c6098cf 100644 --- a/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md +++ b/docs/resources/azure_sql_virtual_machine_group_availability_listeners.md @@ -5,7 +5,7 @@ platform: azure # azure_sql_virtual_machine_group_availability_listeners -Use the `azure_sql_virtual_machine_group_availability_listeners` InSpec audit resource to test properties related to all Azure SQL Virtual Machine Group Availability Listeners. +Use the `azure_sql_virtual_machine_group_availability_listeners` InSpec audit resource to test properties related to all Azure SQL virtual machine group availability listeners. ## Azure REST API version, endpoint and http client parameters @@ -26,7 +26,7 @@ For an example `inspec.yml` file and how to set up your Azure credentials, refer ## Syntax -An `azure_sql_virtual_machine_group_availability_listeners` resource block returns all Azure SQL Virtual Machine Group Availability Listeners. +An `azure_sql_virtual_machine_group_availability_listeners` resource block returns all Azure SQL virtual machine group availability listeners. ```ruby describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do @@ -35,29 +35,30 @@ end ``` ## Parameters -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | -| sql_virtual_machine_group_name | AQL Virtual Machine Group Name | -The parameter set should be provided for a valid query: -- `resource_group` && `sql_virtual_machine_group_name` +`resource_group` _(required)_ + +Azure resource group that the targeted resource resides in. + +`sql_virtual_machine_group_name` _(required)_ + +Azure SQL virtual machine group name ## Properties |Property | Description | Filter Criteria* | |--------------------------------|------------------------------------------------------------------------|------------------| | ids | A list of resource IDs. | `id` | -| names | A list of resource Names. | `name` | +| names | A list of resource names. | `name` | | types | A list of the resource types. | `type` | -| properties | A list of Properties for all the SQL Virtual Machine Group Availability Listeners. | `properties` | -| provisioningStates | A list of provisioning states of the SQL Virtual Machine Group Availability Listeners. | `provisioningState`| +| properties | A list of Properties for all the SQL virtual machine group availability listeners. | `properties` | +| provisioningStates | A list of provisioning states of the SQL virtual machine group availability listeners. | `provisioningState`| * For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). ## Examples -### Loop through SQL Virtual Machine Group Availability Listeners by their names. +### Loop through SQL virtual machine group availability listeners by their names. ```ruby azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME').names.each do |name| @@ -66,7 +67,8 @@ azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE end end ``` -### Test that there are SQL Virtual Machine Group Availability Listeners that are successfully provisioned. + +### Test that there are SQL virtual machine group availability listeners that are successfully provisioned. ```ruby describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME').where(provisioningState: 'Succeeded') do @@ -81,15 +83,16 @@ This InSpec audit resource has the following special matchers. For a full list o ### exists ```ruby -# Should not exist if no SQL Virtual Machine Group Availability Listeners are present +# Should not exist if no SQL virtual machine group availability listeners are present describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do it { should_not exist } end -# Should exist if the filter returns at least one SQL Virtual Machine Group Availability Listeners +# Should exist if the filter returns at least one SQL virtual machine group availability listeners describe azure_sql_virtual_machine_group_availability_listeners(resource_group: 'RESOURCE_GROUP', sql_virtual_machine_group_name: 'SQL_VIRTUAL_MACHINE_GROUP_NAME') do it { should exist } end ``` + ## Azure Permissions -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test.