Azure / Azure/arm-template-whatif
Noisy response when deploying API Management APIs under the Product
- Dominant language
- HTML
- Stars
- 102
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
## Describe the noise
When redeploying the resources below, what-if shows a 'Create' change for the existing API under the specific Product, as well as some changes in API itself.
**Resource type**
Microsoft.ApiManagement/service/products/apis
**apiVersion**
2021-12-01-preview
**Client**
Azure CLI
**Relevant ARM Template code (we only need the resource object for the above `resourceType` and `apiVersion`, but if it's easier you can include the entire template**
apim-resources.bicep
```bicep
param apiManagementServiceName string
param productName string
param apiServices array
param apiManagementPolicyBase64 string
resource apimInstance 'Microsoft.ApiManagement/service@2021-12-01-preview' existing = {
name: apiManagementServiceName
}
module apisModule 'apim-api.bicep' = [for apiService in apiServices: {
name: 'apim-api-${apiService.name}'
params: {
apimName: apiManagementServiceName
name: apiService.name
displayName: apiService.displayName
serviceUrl: apiService.serviceUrl
swaggerJsonRelativePath: apiService.swaggerJsonRelativePath
path: apiService.path
apiPolicyXml: apiService.apiPolicyXml
}
}]
resource apimProduct 'Microsoft.ApiManagement/service/products@2021-12-01-preview' = {
name: '${productName}-product'
parent: apimInstance
dependsOn: [ apisModule ]
properties: {
subscriptionRequired: false
displayName: productName
state: 'published'
}
resource apimApi 'apis' = [for apiService in apiServices: {
name: '${apiService.name}'
}]
}
```
apim-api.bicep
```bicep
param apimName string
param name string
param path string
param displayName string
param serviceUrl string
param swaggerJsonRelativePath string
param apiPolicyXml string
resource apimInstance 'Microsoft.ApiManagement/service@2021-12-01-preview' existing = {
name: apimName
}
resource apimAPI 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = {
name: name
parent: apimInstance
properties: {
path: path
displayName: displayName
serviceUrl: 'https://${serviceUrl}'
format: 'openapi-link'
apiType: 'http'
type: 'http'
isCurrent: true
protocols: [
'https'
]
subscriptionRequired: true
value: 'https://${serviceUrl}${swaggerJsonRelativePath}'
}
}
resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2022-04-01-preview' = {
name: 'policy'
parent: apimAPI
properties: {
format:'xml'
value: base64ToString(apiPolicyXml)
}
}
```
**Expected response (i.e. "I expected no noise since the template has not been modified since the resources were deployed)**
No changes are reported since no changes were made in-between deployments.
**Current (noisy) response (either include a screenshot of the what-if output, or copy/paste the text)**
```
+ Microsoft.ApiManagement/service/xxxxxxxx/products/product-1/apis/api-1 [2021-12-01-preview]
apiVersion: "2021-12-01-preview"
id: "/subscriptions/xxxxxxxx/resourceGroups/rg-1/providers/Microsoft.ApiManagement/service/xxxxxxxx/products/product-1/apis/api-1"
name: "api1"
type: "Microsoft.ApiManagement/service/products/apis"
~ Microsoft.ApiManagement/service/xxxxxxxx/apis/api-1 [2021-12-01-preview]
- properties.contact:
name: "company-1"
url: "https://www.company1.com/"
- properties.description: "api-1 description"
- properties.subscriptionKeyParameterNames.header: "Ocp-Apim-Subscription-Key"
+ properties.type: "http"
x properties.isCurrent: true
```
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Azure CLI what-if deployment with the resources shown in apim-resources.bicep and apim-api.bicep, using the Microsoft.ApiManagement resource versions in the issue. Compare the nested products/apis resource with the existing service/apis resource and the reported property changes. Done means an unchanged redeployment no longer reports the nested API creation or unrelated API changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100