Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated resources #602

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
51 changes: 3 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,53 +402,8 @@ They can be defined as environment variables or resource parameters (has priorit

<hr>

> <b>WARNING</b> The following resources are using their `azure_` counterparts under the hood and they will be deprecated in the InSpec Azure version **2**.
> Their api versions are fixed (see below) for full backward compatibility.
> It is strongly advised to start using the resources with `azure_` prefix for an up-to-date testing experience.

| Legacy Resource Name | Fixed [api version](#api_version) | Replaced by |
|------------------------------------------|----------------------------|-------------------------------|
| azurerm_ad_user, azurerm_ad_users | `v1.0` | [azure_graph_user](docs/resources/azure_graph_user.md), [azure_graph_users](docs/resources/azure_graph_users.md) |
| azurerm_aks_cluster, azurerm_aks_clusters | `2018-03-31` | [azure_aks_cluster](docs/resources/azure_aks_cluster.md), [azure_aks_cluster](docs/resources/azure_aks_cluster.md) |
| azurerm_api_management, azurerm_api_managements | `2019-12-01` | [azure_api_management](docs/resources/azure_api_management.md), [azure_api_managements](docs/resources/azure_api_managements.md) |
| azurerm_application_gateway, azurerm_application_gateways | `2019-12-01` | [azure_application_gateway](docs/resources/azure_application_gateway.md), [azure_application_gateways](docs/resources/azure_application_gateways.md) |
| azurerm_cosmosdb_database_account | `2015-04-08` | [azure_cosmosdb_database_account](docs/resources/azure_cosmosdb_database_account.md) |
| azurerm_event_hub_authorization_rule | `2017-04-01` | [azure_event_hub_authorization_rule](docs/resources/azure_event_hub_authorization_rule.md) |
| azurerm_event_hub_event_hub | `2017-04-01` | [azure_event_hub_event_hub](docs/resources/azure_event_hub_event_hub.md) |
| azurerm_event_hub_namespace | `2017-04-01` | [azure_event_hub_namespace](docs/resources/azure_event_hub_namespace.md) |
| azurerm_hdinsight_cluster | `2015-03-01-preview` | [azure_hdinsight_cluster](docs/resources/azure_hdinsight_cluster.md) |
| azurerm_iothub | `2018-04-01` | [azure_iothub](docs/resources/azure_iothub.md) |
| azurerm_iothub_event_hub_consumer_group, azurerm_iothub_event_hub_consumer_groups |`2018-04-01` | [azure_iothub_event_hub_consumer_group](docs/resources/azure_iothub_event_hub_consumer_group.md), [azure_iothub_event_hub_consumer_groups](docs/resources/azure_iothub_event_hub_consumer_groups.md) |
| azurerm_key_vault, azurerm_key_vaults | `2016-10-01` | [azure_key_vault](docs/resources/azure_key_vault.md), [azure_key_vaults](docs/resources/azure_key_vaults.md) |
| azurerm_key_vault_key, azurerm_key_vault_keys | `2016-10-01` | [azure_key_vault_key](docs/resources/azure_key_vault_key.md), [azure_key_vault_keys](docs/resources/azure_key_vault_keys.md) |
| azurerm_key_vault_secret, azurerm_key_vault_secrets | `2016-10-01` | [azure_key_vault_secret](docs/resources/azure_key_vault_secret.md), [azure_key_vault_secrets](docs/resources/azure_key_vault_secrets.md) |
| azurerm_load_balancer, azurerm_load_balancers | `2018-11-01` | [azure_load_balancer](docs/resources/azure_load_balancer.md), [azure_load_balancers](docs/resources/azure_load_balancers.md) |
| azurerm_locks | `2016-09-01` | [azure_locks](docs/resources/azure_locks.md) |
| azurerm_management_group, azurerm_management_groups | `2018-03-01-preview` | [azure_management_group](docs/resources/azure_management_group.md), [azure_management_groups](docs/resources/azure_management_groups.md) |
| azurerm_mariadb_server, azurerm_mariadb_servers | `2018-06-01-preview` | [azure_mariadb_server](docs/resources/azure_mariadb_server.md), [azure_mariadb_servers](docs/resources/azure_mariadb_servers.md) |
| azurerm_monitor_activity_log_alert, azurerm_monitor_activity_log_alerts | `2017-04-01` | [azure_monitor_activity_log_alert](docs/resources/azure_monitor_activity_log_alert.md), [azure_monitor_activity_log_alerts](docs/resources/azure_monitor_activity_log_alerts.md) |
| azurerm_monitor_log_profile, azurerm_monitor_log_profiles | `2016-03-01` | [azure_monitor_log_profile](docs/resources/azure_monitor_log_profile.md), [azure_monitor_log_profiles](docs/resources/azure_monitor_log_profiles.md) |
| azurerm_mysql_database, azurerm_mysql_databases | `2017-12-01` | [azure_mysql_database](docs/resources/azure_mysql_database.md), [azure_mysql_databases](docs/resources/azure_mysql_databases.md) |
| azurerm_mysql_server, azurerm_mysql_servers | `2017-12-01` | [azure_mysql_server](docs/resources/azure_mysql_server.md), [azure_mysql_servers](docs/resources/azure_mysql_servers.md) |
| azurerm_network_interface, azurerm_network_interfaces | `2018-11-01` | [azure_network_interface](docs/resources/azure_network_interface.md), [azure_network_interfaces](docs/resources/azure_network_interfaces.md) |
| azurerm_network_security_group, azurerm_network_security_groups | `2018-02-01` | [azure_network_security_group](docs/resources/azure_network_security_group.md), [azure_network_security_groups](docs/resources/azure_network_security_groups.md) |
| azurerm_network_watcher, azurerm_network_watchers | `2018-02-01` | [azure_network_watcher](docs/resources/azure_network_watcher.md), [azure_network_watchers](docs/resources/azure_network_watchers.md) |
| azurerm_postgresql_database, azurerm_postgresql_databases | `2017-12-01` | [azure_postgresql_database](docs/resources/azure_postgresql_database.md), [azure_postgresql_databases](docs/resources/azure_postgresql_databases.md) |
| azurerm_postgresql_server, azurerm_postgresql_servers | `2017-12-01` | [azure_postgresql_server](docs/resources/azure_postgresql_server.md), [azure_postgresql_servers](docs/resources/azure_postgresql_servers.md) |
| azurerm_public_ip | `2020-05-01` | [azure_public_ip](docs/resources/azure_public_ip.md) |
| azurerm_resource_groups | `2018-02-01` | [azure_resource_groups](docs/resources/azure_resource_groups.md) |
| azurerm_role_definition, azurerm_role_definitions | `2015-07-01` | [azure_role_definition](docs/resources/azure_role_definition.md), [azure_role_definitions](docs/resources/azure_role_definitions.md) |
| azurerm_security_center_policy, azurerm_security_center_policies | `2015-06-01-Preview` | [azure_security_center_policy](docs/resources/azure_security_center_policy.md), [azure_security_center_policies](docs/resources/azure_security_center_policies.md) |
| azurerm_sql_database, azurerm_sql_databases | `2017-10-01-preview` | [azure_sql_database](docs/resources/azure_sql_database.md), [azure_sql_databases](docs/resources/azure_sql_databases.md) |
| azurerm_sql_server, azurerm_sql_servers | `2018-06-01-preview` | [azure_sql_server](docs/resources/azure_sql_server.md), [azure_sql_servers](docs/resources/azure_sql_servers.md) |
| azurerm_storage_account, azurerm_storage_accounts | `2017-06-01` | [azure_storage_account](docs/resources/azure_storage_account.md), [azure_storage_accounts](docs/resources/azure_storage_accounts.md) |
| azurerm_storage_account_blob_container, azurerm_storage_account_blob_containers | `2018-07-01` | [azure_storage_account_blob_container](docs/resources/azure_storage_account_blob_container.md), [azure_storage_account_blob_containers](docs/resources/azure_storage_account_blob_containers.md) |
| azurerm_subnet, azurerm_subnets | `2018-02-01` | [azure_subnet](docs/resources/azure_subnet.md), [azure_subnets](docs/resources/azure_subnets.md) |
| azurerm_subscription | `2019-10-01` | [azure_subscription](docs/resources/azure_subscription.md) |
| azurerm_virtual_machine, azurerm_virtual_machines | `2017-12-01` | [azure_virtual_machine](docs/resources/azure_virtual_machine.md), [azure_virtual_machines](docs/resources/azure_virtual_machines.md) |
| azurerm_virtual_machine_disk, azurerm_virtual_machine_disks | `2017-03-30` | [azure_virtual_machine_disk](docs/resources/azure_virtual_machine_disk.md), [azure_virtual_machine_disks](docs/resources/azure_virtual_machine_disks.md) |
| azurerm_virtual_network, azurerm_virtual_networks | `2018-02-01` | [azure_virtual_network](docs/resources/azure_virtual_network.md), [azure_virtual_networks](docs/resources/azure_virtual_networks.md) |
| azurerm_webapp, azurerm_webapps | `2016-08-01` | [azure_webapp](docs/resources/azure_webapp.md), [azure_webapps](docs/resources/azure_webapps.md) |
> <b>WARNING</b> The `azurerm_` resources are removed completely from inspec-azure V2.
> It is mandatory to use resources only with `azure_` prefix for an up-to-date testing experience.

## Development

Expand Down Expand Up @@ -581,7 +536,7 @@ Please refer to the [Microsoft Documentation](https://docs.microsoft.com/en-us/a
To run a control called `azure_virtual_machine` only:

```shell
rake test:integration[azurerm_virtual_machine]
rake test:integration[azure_virtual_machine]
```

Note that in zsh you need to escape the `[`, `]` characters.
Expand Down
4 changes: 2 additions & 2 deletions dev-docs/resource_creation_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class AzureKeyVaults < AzureGenericResources
name 'azure_key_vaults'
desc 'Verifies settings for a collection of Azure Key Vaults'
example <<-EXAMPLE
describe azurerm_key_vaults(resource_group: 'rg-1') do
describe azure_key_vaults(resource_group: 'rg-1') do
it { should exist }
its('names') { should include 'vault-1'}
end
Expand Down Expand Up @@ -471,7 +471,7 @@ class AzureKeyVaults < AzureGenericResources
name 'azure_key_vaults'
desc 'Verifies settings for a collection of Azure Key Vaults'
example <<-EXAMPLE
describe azurerm_key_vaults(resource_group: 'rg-1') do
describe azure_key_vaults(resource_group: 'rg-1') do
it { should exist }
its('names') { should include 'vault-1'}
end
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_api_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ azure_api_managements.ids.each do |resource_id|
end
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_api_management.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_api_management.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_application_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe azure_application_gateway(resource_id: '/subscriptions/{subscriptionId}
end
```

See [integration tests](../../test/integration/verify/controls/azurerm_application_gateway.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_application_gateway.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_hdinsight_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe azure_hdinsight_cluster(resource_group: 'example', name: 'ClusterName')
its('properties.clusterVersion') { should cmp '4.0' }
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_hdinsight_cluster.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_hdinsight_cluster.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_management_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe azure_management_group(group_id: 'abc-1234', recurse: true, expand: 'ch
its('children_display_names') { should include('I am a child of the group!') }
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_management_group.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_management_group.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_network_watcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ azure_network_security_groups.where(location: 'eastus').ids.each do |nsg_id|
end
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_network_watcher.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_network_watcher.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_public_ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe azure_public_ip(resource_id: '/subscriptions/{subscriptionId}/resourceG
its('properties.ipAddress') { should cmp '51.224.11.75' }
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_public_ip.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_public_ip.rb) for more examples.

## Matchers

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/azure_security_center_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe azure_security_center_policy(resource_group: 'my-rg', name: 'my_policy'
its('notifications_enabled') { should be true }
end
```
See [integration tests](../../test/integration/verify/controls/azurerm_security_center_policy.rb) for more examples.
See [integration tests](../../test/integration/verify/controls/azure_security_center_policy.rb) for more examples.

## Matchers

Expand Down
8 changes: 4 additions & 4 deletions docs/resources/azure_storage_account_blob_containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For an example `inspec.yml` file and how to set up your Azure credentials, refer

The `resource_group`, and `storage_account_name` must be given as a parameter.
```ruby
describe azurerm_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
describe azure_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
its('names') { should include 'my-container'}
end
```
Expand All @@ -55,7 +55,7 @@ end

### Check If a Specific Container Exists
```ruby
describe azurerm_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
describe azure_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
its('names') { should include('my-container') }
end
```
Expand All @@ -64,12 +64,12 @@ end
The control will pass if the filter returns at least one result. Use `should_not` if you expect zero matches.
```ruby
# If we expect at least one resource to exists on a specified account
describe azurerm_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
describe azure_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
it { should exist }
end

# If we expect not to exist any containers on a specified account
describe azurerm_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
describe azure_storage_account_blob_containers(resource_group: 'rg', storage_account_name: 'production') do
it { should_not exist }
end
```
Expand Down
22 changes: 0 additions & 22 deletions libraries/azure_aks_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,3 @@ def disabled_logging_types
result
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermAksCluster < AzureAksCluster
name 'azurerm_aks_cluster'
desc 'Verifies settings for AKS Clusters'
example <<-EXAMPLE
describe azurerm_aks_cluster(resource_group: 'example', name: 'name') do
its(name) { should eq 'name'}
end
EXAMPLE

def initialize(opts = {})
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureAksCluster.name)
# For backward compatibility.
opts[:api_version] ||= '2018-03-31'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_aks_clusters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,3 @@ def to_s
super(AzureAksClusters)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermAksClusters < AzureAksClusters
name 'azurerm_aks_clusters'
desc 'Verifies settings for AKS Clusters'
example <<-EXAMPLE
azurerm_aks_clusters(resource_group: 'example') do
it{ should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureAksClusters.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2018-03-31'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_api_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,3 @@ def to_s
super(AzureApiManagement)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermApiManagement < AzureApiManagement
name 'azurerm_api_management'
desc 'Verifies settings for an Azure Api Management Service'
example <<-EXAMPLE
describe azurerm_api_management(resource_group: 'rg-1', api_management_name: 'apim01') do
it { should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureApiManagement.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2019-12-01'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_api_managements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,3 @@ def to_s
super(AzureApiManagements)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermApiManagements < AzureApiManagements
name 'azurerm_api_managements'
desc 'Verifies settings for a collection of Azure Api Management Services'
example <<-EXAMPLE
describe azurerm_api_managements do
it { should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureApiManagements.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2019-12-01'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_application_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,3 @@ def to_s
super(AzureApplicationGateway)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermApplicationGateway < AzureApplicationGateway
name 'azurerm_application_gateway'
desc 'Verifies settings for an Azure Application Gateway'
example <<-EXAMPLE
describe azurerm_application_gateway(resource_group: 'rg-1', application_gateway_name: 'lb-1') do
it { should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureApplicationGateway.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2019-12-01'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_application_gateways.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,3 @@ def to_s
super(AzureApplicationGateways)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermApplicationGateways < AzureApplicationGateways
name 'azurerm_application_gateways'
desc 'Verifies settings for a collection of Azure Application Gateways'
example <<-EXAMPLE
describe azurerm_application_gateways do
it { should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureApplicationGateways.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2019-12-01'
super
end
end
22 changes: 0 additions & 22 deletions libraries/azure_container_registries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,3 @@ def to_s
super(AzureContainerRegistries)
end
end

# Provide the same functionality under the old resource name.
# This is for backward compatibility.
class AzurermContainerRegistries < AzureContainerRegistries
name 'azurerm_container_registries'
desc 'Verifies settings for a collection of Azure Container Registries'
example <<-EXAMPLE
describe azurerm_container_registries do
it { should exist }
end
EXAMPLE

def initialize(opts = {})
Inspec::Log.warn Helpers.resource_deprecation_message(@__resource_name__, AzureContainerRegistries.name)
# Options should be Hash type. Otherwise Ruby will raise an error when we try to access the keys.
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash)

# For backward compatibility.
opts[:api_version] ||= '2019-05-01'
super
end
end
Loading