azure-sdk-for-go
azure-sdk-for-go copied to clipboard
`service/monitor`: Invalid API version used
Bug Report
2021-11-16T13:12:35.410+0100 [DEBUG] provider.terraform-provider-azurerm_v2.85.0_x5: AzureRM Request:
PUT /subscriptions/xxx/resourceGroups/eastus2-dwx-heap-nonprod-dev-fdm-rg/providers/Microsoft.ApiManagement/service/eastus2-dwx-heap-nonprod-dev-fdm-apim/providers/Microsoft.Insigh
ts/diagnosticSettings/eastus2-dwx-heap-nonprod-dev-fdm-st-ds?api-version=2017-05-01-preview HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v59.0.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.11 (+https://www.terraform.io) Terraform Plugin SDK/2.8.0 terraform-provider-
azurerm/2.85.0 pid-5a669062-d8d0-471f-b36a-40115651cea7
Content-Length: 587
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 67bfabad-7c0f-ebe5-3e62-f97f4b9b57cc
Accept-Encoding: gzip
{"properties":{"metrics":[{"category":"AllMetrics","enabled":true,"retentionPolicy":{"enabled":true,"days":15}}],"logs":[{"category":"WebSocketConnectionLogs","enabled":true,"retentionPolicy":{"enabled":true,"days
":15}},{"category":"GatewayLogs","enabled":true,"retentionPolicy":{"enabled":true,"days":15}}],"workspaceId":"/subscriptions/xxx/resourceGroups/eastus2-dwx-heap-nonprod-main-log-an
alytics-rg/providers/Microsoft.OperationalInsights/workspaces/eastus2-dwx-heap-nonprod-main-log-analytics-law","logAnalyticsDestinationType":"AzureDiagnostics"}}: timestamp=2021-11-16T13:12:35.410+0100
2021-11-16T13:12:37.100+0100 [DEBUG] provider.terraform-provider-azurerm_v2.85.0_x5: AzureRM Response for https://management.azure.com/subscriptions/xxx/resourceGroups/eastus2-dwx-
heap-nonprod-dev-fdm-rg/providers/Microsoft.ApiManagement/service/eastus2-dwx-heap-nonprod-dev-fdm-apim/providers/Microsoft.Insights/diagnosticSettings/eastus2-dwx-heap-nonprod-dev-fdm-st-ds?api-version=2017-05-01
-preview:
HTTP/2.0 400 Bad Request
Content-Length: 187
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Nov 2021 12:12:36 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 67bfabad-7c0f-ebe5-3e62-f97f4b9b57cc
X-Ms-Ratelimit-Remaining-Subscription-Resource-Requests: 149
X-Ms-Request-Id: 00000000-0000-0000-0000-000000000000
X-Ms-Routing-Request-Id: WESTEUROPE:20211116T121237Z:7340dafe-f643-4383-996a-abee8c9cc5a6
{"code":"BadRequest","message":"Invalid API Verion used to modify log category group enabled setting: eastus2-dwx-heap-nonprod-dev-fdm-st-ds, please use version post: 2021-05-01-preview"}: timestamp=2021-11-16T13:
12:37.100+0100
It seem that this might be a typo here? https://github.com/Azure/azure-sdk-for-go/blob/v59.0.0/services/preview/monitor/mgmt/2021-07-01-preview/insights/diagnosticsettings.go#L86
This happens on the API diag settings. When there are no diag settings present, terrafrom creates them just fine. And they are created like so:
If the diag settings are modified to be this:
then terraform does not see the diag settings anymore and wants to create them, which fails with the error above.
// cc @ArcturusZhang
Hi @favoretti thanks for this issue. The swagger of monitor is now not in a good state. Every package in track 1 SDK is generated from a tag which consists quite a few swaggers from different api-version, and this composition is created by the service team.
The API that is complaining about API versions, comes from this file here:
Microsoft.Insights/preview/2017-05-01-preview/diagnosticsSettings_API.json
as you can see, it claims itself as API version 2017-05-01-preview
, but why the service returns error about this, I have to defer some one from the monitor team to answer.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azmonapplicationinsights.
Issue Details
Bug Report
2021-11-16T13:12:35.410+0100 [DEBUG] provider.terraform-provider-azurerm_v2.85.0_x5: AzureRM Request:
PUT /subscriptions/xxx/resourceGroups/eastus2-dwx-heap-nonprod-dev-fdm-rg/providers/Microsoft.ApiManagement/service/eastus2-dwx-heap-nonprod-dev-fdm-apim/providers/Microsoft.Insigh
ts/diagnosticSettings/eastus2-dwx-heap-nonprod-dev-fdm-st-ds?api-version=2017-05-01-preview HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v59.0.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.11 (+https://www.terraform.io) Terraform Plugin SDK/2.8.0 terraform-provider-
azurerm/2.85.0 pid-5a669062-d8d0-471f-b36a-40115651cea7
Content-Length: 587
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 67bfabad-7c0f-ebe5-3e62-f97f4b9b57cc
Accept-Encoding: gzip
{"properties":{"metrics":[{"category":"AllMetrics","enabled":true,"retentionPolicy":{"enabled":true,"days":15}}],"logs":[{"category":"WebSocketConnectionLogs","enabled":true,"retentionPolicy":{"enabled":true,"days
":15}},{"category":"GatewayLogs","enabled":true,"retentionPolicy":{"enabled":true,"days":15}}],"workspaceId":"/subscriptions/xxx/resourceGroups/eastus2-dwx-heap-nonprod-main-log-an
alytics-rg/providers/Microsoft.OperationalInsights/workspaces/eastus2-dwx-heap-nonprod-main-log-analytics-law","logAnalyticsDestinationType":"AzureDiagnostics"}}: timestamp=2021-11-16T13:12:35.410+0100
2021-11-16T13:12:37.100+0100 [DEBUG] provider.terraform-provider-azurerm_v2.85.0_x5: AzureRM Response for https://management.azure.com/subscriptions/xxx/resourceGroups/eastus2-dwx-
heap-nonprod-dev-fdm-rg/providers/Microsoft.ApiManagement/service/eastus2-dwx-heap-nonprod-dev-fdm-apim/providers/Microsoft.Insights/diagnosticSettings/eastus2-dwx-heap-nonprod-dev-fdm-st-ds?api-version=2017-05-01
-preview:
HTTP/2.0 400 Bad Request
Content-Length: 187
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Nov 2021 12:12:36 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 67bfabad-7c0f-ebe5-3e62-f97f4b9b57cc
X-Ms-Ratelimit-Remaining-Subscription-Resource-Requests: 149
X-Ms-Request-Id: 00000000-0000-0000-0000-000000000000
X-Ms-Routing-Request-Id: WESTEUROPE:20211116T121237Z:7340dafe-f643-4383-996a-abee8c9cc5a6
{"code":"BadRequest","message":"Invalid API Verion used to modify log category group enabled setting: eastus2-dwx-heap-nonprod-dev-fdm-st-ds, please use version post: 2021-05-01-preview"}: timestamp=2021-11-16T13:
12:37.100+0100
It seem that this might be a typo here? https://github.com/Azure/azure-sdk-for-go/blob/v59.0.0/services/preview/monitor/mgmt/2021-07-01-preview/insights/diagnosticsettings.go#L86
Author: | favoretti |
---|---|
Assignees: | lirenhe |
Labels: |
|
Milestone: | - |
@ArcturusZhang Any news on that? Would really like to have API version 2021-05-01-preview
of diagnosticsettings
in the azure-sdk-for-go to add categoryGroup
in the regarding terraform provider resource, see https://github.com/hashicorp/terraform-provider-azurerm/issues/14333
Let me follow up with someone from the monitor team. We are planning to solve the messy swagger of monitor recently. Stay tuned
@ArcturusZhang Since some time has past now. Are there any news on that topic?
We are introducing a new api-version in this PR, I will try to make sure this could be fixed in that PR.
@ArcturusZhang The PR you mentioned is merged. Can you tell what are the next steps? Is this issue solved by that?
@ArcturusZhang Any news here?