Skip to content
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

Diagnostics - Retention policy causing resource creation failure #122

Open
gstevens-kyriba opened this issue Sep 13, 2024 · 1 comment
Open

Comments

@gstevens-kyriba
Copy link

gstevens-kyriba commented Sep 13, 2024

It seems many of the CARML modules enable Diagnostic Logging on the resources created. However, it seems this has changed and several resources won't create due to the retention policy setting. The error is:

Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Diagnostic settings does not support retention for new diagnostic settings."

I'm working around it by commenting out the retentionPolicy on various resources to get them to create.
I've commented out the retention policy on:

bicep\CARML\Microsoft.ContainerRegistry\registries\deploy.bicep
bicep\CARML\Microsoft.Network\applicationGateways\deploy.bicep
bicep\CARML\Microsoft.Network\azureFirewalls\deploy.bicep
bicep\CARML\Microsoft.Network\bastionHosts\deploy.bicep
bicep\CARML\Microsoft.Network\networkSecurityGroups\deploy.bicep
bicep\CARML\Microsoft.Network\virtualNetworks\deploy.bicep

var diagnosticsLogsSpecified = [for category in filter(diagnosticLogCategoriesToEnable, item => item != 'allLogs'): {
category: category
enabled: true
// retentionPolicy: {
// enabled: true
// days: diagnosticLogsRetentionInDays
// }
}]

var diagnosticsLogs = contains(diagnosticLogCategoriesToEnable, 'allLogs') ? [
{
categoryGroup: 'allLogs'
enabled: true
// retentionPolicy: {
// enabled: true
// days: diagnosticLogsRetentionInDays
// }
}
] : diagnosticsLogsSpecified

var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: {
category: metric
timeGrain: null
enabled: true
// retentionPolicy: {
// enabled: true
// days: diagnosticLogsRetentionInDays
// }
}]

@gstevens-kyriba
Copy link
Author

Looks like a similar issue here, resolved in a similar manner: hashicorp/terraform-provider-azurerm#23051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant