Azure / arm-template-whatif

A repository to track issues related to what-if noise suppression
MIT License
90 stars 14 forks source link

unexpected differences in what if for azure web app deployment slot #312

Open sabbadino opened 1 year ago

sabbadino commented 1 year ago

Bicep version 0.16.2 (de7fdd2b33)

Describe the bug "what if" on azure web app deployment slot report a lot of things that would be deleted (looks like default values not provided in bicep). If I run the bicep and then run "what if" again the same differences are shown again.

To Reproduce

create a RG .. deploy this bicep .. then run what if : you get many differences (Deletes mostly) for slot ..

run bicep again run "what if" again : you get again many differences (Deletes mostly) for slot ..

bicep :

param env string 
param aspnetcore_env string
param location string 
param app_plan_skuName string
param app_plan_capacity int
param app_plan_grpc_name string 
param app_grpc_name string 
param app_grpc_tag string 
param linuxFxVersion string = 'DOTNETCORE|6.0' 
// grpc Service
resource app_plan_grpc_resource 'Microsoft.Web/serverfarms@2022-03-01' = {
  name: app_plan_grpc_name
  location: location
  tags: {
    _Agency: 'MSC Italy'
    _Product: 'mymsc'
    _Scope: 'mymsc'
    env: env
    service: app_grpc_tag

  }
  properties: {
    reserved: true
  }
  sku: {
    name: app_plan_skuName
    capacity: app_plan_capacity
  }
  kind: 'linux'
}

resource app_grpc_resource 'Microsoft.Web/sites@2022-03-01' =  {
  name: app_grpc_name
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  tags: {
    _Agency: 'MSC Italy'
    _Product: 'mymsc'
    _Scope: 'mymsc'
    env: env
    service: app_grpc_tag

  }
  properties: {
    enabled: true
    serverFarmId: app_plan_grpc_resource.id
    siteConfig: {
      numberOfWorkers: 1
      acrUseManagedIdentityCreds: false
      alwaysOn: true
      http20Enabled: false
      functionAppScaleLimit: 0
      minimumElasticInstanceCount: 0
      linuxFxVersion: linuxFxVersion
      ftpsState: 'Disabled'
      healthCheckPath: '/health'
    }
    scmSiteAlsoStopped: false
    clientAffinityEnabled: false
    httpsOnly: true
    keyVaultReferenceIdentity: 'SystemAssigned'
  }

}

var appSettingsGrpc = [
      {
        name: 'ASPNETCORE_ENVIRONMENT'
        value: aspnetcore_env
      }
      {
        name: 'WEBSITE_LOAD_CERTIFICATES'
        value: '*'
      }
    ]

resource app_grpc_resource_config 'Microsoft.Web/sites/config@2022-03-01' =  {
  parent: app_grpc_resource
  name: 'web'

  properties: {
    appSettings: appSettingsGrpc
    numberOfWorkers: 1
    alwaysOn: true
  }

}

resource app_grpc_resource_slot 'Microsoft.Web/sites/slots@2022-03-01' = {
  name: 'staging'
  location: location
  tags: {
    _Agency: 'MSC Italy'
    _Product: 'mymsc'
    _Scope: 'mymsc'
    env: env
    service: app_grpc_tag
  }
  parent: app_grpc_resource
  properties: {
    enabled: true
    serverFarmId: app_plan_grpc_resource.id
    siteConfig: {
      numberOfWorkers: 1
      acrUseManagedIdentityCreds: false
      alwaysOn: true
      http20Enabled: false
      functionAppScaleLimit: 0
      minimumElasticInstanceCount: 0
      linuxFxVersion: linuxFxVersion
      ftpsState: 'Disabled'
      healthCheckPath: '/health'
    }
    scmSiteAlsoStopped: false
    clientAffinityEnabled: false
    httpsOnly: true
  }
  identity: {
    type: 'SystemAssigned'
  }
}

resource app_grpc_resource_slot_config 'Microsoft.Web/sites/slots/config@2021-03-01' = {
  parent: app_grpc_resource_slot
  name: 'web'
  properties: {
    appSettings: appSettingsGrpc
    numberOfWorkers: 1
    alwaysOn: true
  }
}
sabbadino commented 1 year ago

here is the output of what-if : my main concerns are the differences (deletes) in the deployment slot

Resource and property changes are indicated with these symbols:

The deployment will update the following scope:

Scope: /subscriptions/d642528f-3525-4e1b-bf17-fe100458b4e1/resourceGroups/test-bicep

~ Microsoft.Web/sites/sabba-cicd-awa00-quote-grpc [2022-03-01]

Resource changes: 4 to modify, 1 no change.