-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Retention Policy of Azure Activity Logs Diagnostic Settings are being discarded #13470
Comments
btw this ONLY applies to subscription scopes (For exporting Activity Log) -- other resources seem to still support this, and it's working as expected. I'm working around this by putting a blob lifecycle policy on the account I'm exporting it to resource "azurerm_storage_management_policy" "ops_security" {
storage_account_id = azurerm_storage_account.ops_security.id
rule {
name = "DeleteAfter1Year"
enabled = true
filters {
}
actions {
base_blob {
delete_after_days_since_modification_greater_than = 365
}
snapshot {
delete_after_days_since_creation_greater_than = 365
}
version {
delete_after_days_since_creation = 365
}
}
}
} |
The problem still persists with terraform v1.0.11. Thanks for the workaround @kensykora. Unfortunately this affects the assessment results of Regulatory Compliance Checks. |
Duplicate or related to #10388 ? |
Duplicate of #10388 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform (and AzureRM Provider) Version
Terraform v1.0.7
Azurerm v2.74.0
Affected Resource(s)
"azurerm_monitor_diagnostic_setting" "activity_logs"
Terraform Configuration Files
Debug Output
Expected Behaviour
Retention Policy of activity logs must not be reprovisioned or updated if the settings hat not being changed.
Actual Behaviour
When first provisioning the activity logs of the subscription to be sent to the log analytics and archived in a storage account, no errors or issues are shown. Everything is working as expected. The next time we try to perform terraform plan or deploy, terraform inform us that the all diagnostic settings of the activity logs must be updated in place (delete --> deploy). After troubleshooting, we found out that following:
Steps to Reproduce
1- write diagnostic settings for the Azure subscription activity logs with retention policy for storage account enabled
2- deploy terraform code: terraform apply
3- rerun terraform plan or apply
Impact
This behavior is affecting the storage account retention time of all activity_logs for the subscription, specially for auditing. As well as having unnecessary delete and apply operations with each apply, which can affect the approvals in the pipeliens.
Important Factoids
N/A
References
N/A
The text was updated successfully, but these errors were encountered: