-
Notifications
You must be signed in to change notification settings - Fork 862
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
API Management API ID doesn't always contain the revision ID #15178
Comments
Hi @Berbe thanks for this issue! But I do not think it is correct behavior to let terraform to manage something that might be tempered by something else. You will get exactly the same situation if one of your terraform-managed resource get changed by some external sources - for instance you enlarged your os disk size of the VM managed by terraform, and run And the ID you are showing in the description, that is the ID of the terraform resource, which should be different from the ARM Resource ID - an ARM resource ID cannot contain special symbols in it. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @miaojiang. Issue DetailsAs indicated in comments, the API ID does not include the revision ID when the revision is current. This is a problem when the returned ID is used to track an object's state, as an API ID without a revision ID doesn't reference a single object across time. For example, if a {
"id": "/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example",
"type": "Microsoft.ApiManagement/service/apis",
"name": "example",
"properties": {
"displayName": "example",
"apiRevision": "1",
"description": "",
"subscriptionRequired": true,
"serviceUrl": "https://example.org",
"path": "petshop3",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "",
"apiVersion": "",
"apiVersionDescription": ""
}
} because revision If the current revision is then to be changed to It would be best if revisions ID were always returned in answers' payload.
|
This is out of scope of this issue: I did not specify the way the current revision changes, as this has no impact on this particular issue, which is how the API behaves/answers.
All I am showing in the description are API queries and answers.
Let me try to explain again, showing you how responses differ between current and non-current revisions. Revision 1 - currentQuery to API: GET /subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=1?api-version=2019-12-01 HTTP/2
Host: management.azure.com
[...] Response: {
"id": "/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example",
"type": "Microsoft.ApiManagement/service/apis",
"name": "example",
"properties": {
"displayName": "example",
"apiRevision": "1",
"description": "",
"subscriptionRequired": true,
"serviceUrl": "https://example.org",
"path": "example",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true,
"apiRevisionDescription": "",
"apiVersion": "",
"apiVersionDescription": ""
}
} Revision 2 - not currentQuery to API: GET /subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=2?api-version=2019-12-01 HTTP/2
Host: management.azure.com
[...] Response: {
"id": "/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=2",
"type": "Microsoft.ApiManagement/service/apis",
"name": "example;rev=2",
"properties": {
"displayName": "example",
"apiRevision": "2",
"description": "",
"subscriptionRequired": true,
"serviceUrl": "https://example.org",
"path": "example",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "",
"apiVersion": "",
"apiVersionDescription": ""
}
} Revision 1 - not currentQuery to API: GET /subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=1?api-version=2019-12-01 HTTP/2
Host: management.azure.com
[...] Response: {
"id": "/subscriptions/a579fc6d-85fe-44a7-9ba6-8f08117c7237/resourceGroups/CA06AZGRGAPI001/providers/Microsoft.ApiManagement/service/CA06AZGAPIM001/apis/test-BR_ps;rev=1",
"type": "Microsoft.ApiManagement/service/apis",
"name": "example;rev=1",
"properties": {
"displayName": "example",
"apiRevision": "1",
"description": "",
"subscriptionRequired": true,
"serviceUrl": "https://example.org",
"path": "example",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "",
"apiVersion": "",
"apiVersionDescription": ""
}
} Revision 2 - currentQuery to API: GET /subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=2?api-version=2019-12-01 HTTP/2
Host: management.azure.com
[...] Response:
The problem here is that by querying a specific revision of an API resource (as seen in the requests above), if the queried revision is current, the In other words, with the same request made to the same specific revision, this
Going through case support with M$ is a nightmare already. So far, support from technical people on GitHub issues was satisfactory. |
We have retired support for Azure SDK for Golang libraries which do not conform to our current Azure SDK guidelines (see announcement). Please migrate to the latest version according to the migration guide. If you could still repo this problem, please submit a support ticket in Azure directly. |
As indicated in comments, the API ID does not include the revision ID when the revision is current.
This is a problem when the returned ID is used to track an object's state, as an API ID without a revision ID doesn't reference a single object across time.
The terraform-provider-azurerm#12766 bug report sheds light on such a situation, which is hardly a Terraform problem, merely relying on the
id
contained in answers toGET
queries on/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=<revision>
resources.For example, if a
GET
query on/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example;rev=1
returns:because revision
1
is current, the tracked ID will be revision-less.If the current revision is then to be changed to
2
, the object tracked by/subscriptions/***/resourceGroups/example/providers/Microsoft.ApiManagement/service/example/apis/example
will be revision2
and not1
, breaking state tracking.It would be best if revisions ID were always returned in answers' payload.
The text was updated successfully, but these errors were encountered: