Skip to content

Commit

Permalink
bicep core: Serialize updates for config-appsettings and config-logs(#…
Browse files Browse the repository at this point in the history
…3125)

Reintroduce a `dependsOn` ordering that is required to avoid race conditions with updating `Microsoft.Web/sites/config` within the same deployment.
  • Loading branch information
weikanglim authored Dec 18, 2023
1 parent 6e8d2ef commit 57830d7
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions templates/common/infra/bicep/core/host/appservice.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {

identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }

resource configLogs 'config' = {
name: 'logs'
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}

resource basicPublishingCredentialsPoliciesFtp 'basicPublishingCredentialsPolicies' = {
name: 'ftp'
properties: {
Expand All @@ -90,7 +80,9 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
}
}

module config 'appservice-appsettings.bicep' = {
// Updates to the single Microsoft.sites/web/config resources that need to be performed sequentially
// sites/web/config 'appsettings'
module configAppSettings 'appservice-appsettings.bicep' = {
name: '${name}-appSettings'
params: {
name: appService.name
Expand All @@ -105,6 +97,19 @@ module config 'appservice-appsettings.bicep' = {
}
}

// sites/web/config 'logs'
resource configLogs 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'logs'
parent: appService
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
dependsOn: [configAppSettings]
}

resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
name: keyVaultName
}
Expand Down

0 comments on commit 57830d7

Please sign in to comment.