inspec / inspec-azure

InSpec Azure Resource Pack
https://www.inspec.io/
Other
97 stars 80 forks source link

Incompatible api version provided for the `azure_resource_group` resource #716

Open niven01 opened 1 year ago

niven01 commented 1 year ago

Describe the problem

Inspec is now failing when working with Resource Groups. I am receiving the following error. This was working 2 weeks ago.

  Azure Resource Group : /resourcegroups/my-resource-group /subscriptions/***/resourcegroups/
     ×  Incompatible api version provided for the `azure_resource_group` resource.
     The latest api version suggested by the Azure REST API is 2022-12-01.
     Error message from the Azure REST API:
     The api-version '2022-12-01' is invalid. The supported versions are '2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.

Inpec.yml contents:

name: azure-inspec-tests
title: Azure InSpec Profile
license: Apache-2.0
summary: An InSpec Compliance Profile For Azure
version: 0.1.0
inspec_version: '>= 4.23.15'
depends:
- name: inspec-azure
  url: https://github.com/inspec/inspec-azure/archive/main.tar.gz
supports:
- platform: azure

If we specify api_version 2022-09-01 then the check passes, example:

describe azure_resource_group(name: resource_group, api_version: '2022-09-01') do
  it { should exist }
  its('api_version_used_for_query_state') { should eq 'user_provided' }
  its('api_version_used_for_query') { should eq '2022-09-01' }
end

Possible Solution

I dont have a solution only a work around