Closed srinathrangaramanujam closed 3 years ago
It seems the error has been fixed already but seems to happen again with latest providers and tf . https://www.bountysource.com/issues/77404614-azurerm_monitor_diagnostic_setting-dynamic-log-metric-blocks-produces-inconsistent-plan
https://www.gitmemory.com/issue/terraform-providers/terraform-provider-azurerm/3900/535438407
https://github.com/terraform-providers/terraform-provider-azurerm/issues/3900
@tombuildsstuff pls help :)
Also running into this:
Module: data "azurerm_client_config" "current" {}
data "azurerm_monitor_diagnostic_categories" "diag_cat" { resource_id = azurerm_sql_server.azss.id }
data "azurerm_resource_group" "rg" { name = var.resource_group_name }
resource "azurerm_sql_server" "azss" { administrator_login = var.administrator_login administrator_login_password = var.administrator_login_password location = data.azurerm_resource_group.rg.location name = var.name resource_group_name = data.azurerm_resource_group.rg.name tags = var.tags version = var.sql_version
extended_auditing_policy { storage_account_access_key = var.extended_auditing_storage_account_access_key storage_endpoint = var.extended_auditing_storage_endpoint retention_in_days = var.extended_auditing_retention_in_days }
identity { type = "SystemAssigned" } }
resource "azurerm_sql_active_directory_administrator" "azssadmin" { server_name = azurerm_sql_server.azss.name resource_group_name = data.azurerm_resource_group.rg.name login = var.ad_login tenant_id = data.azurerm_client_config.current.tenant_id object_id = var.admin_object_id }
resource "azurerm_monitor_diagnostic_setting" "diag" { log_analytics_workspace_id = var.log_analytics_workspace_id name = "sqldiag-${var.name}" storage_account_id = var.storage_account_id target_resource_id = azurerm_sql_server.azss.id
dynamic "log" { for_each = data.azurerm_monitor_diagnostic_categories.diag_cat.logs iterator = log_category
content {
category = log_category.value
enabled = var.diag_logging_enabled
retention_policy {
days = var.logs_retention_in_days
enabled = var.diag_logging_enabled
}
}
}
dynamic "metric" { for_each = data.azurerm_monitor_diagnostic_categories.diag_cat.metrics iterator = metric_category
content {
category = metric_category.value
enabled = var.diag_logging_enabled
retention_policy {
days = var.logs_retention_in_days
enabled = var.diag_logging_enabled
}
}
}
// lifecycle { // ignore_changes = [ // log, // ] // } }
Calling Module: module "sql_01" { source = "" ad_login = var.ad_login administrator_login_password = var.admin_pass admin_object_id = var.admin_object_id extended_auditing_storage_account_access_key = data.azurerm_storage_account.storage.primary_access_key extended_auditing_storage_endpoint = data.azurerm_storage_account.storage.primary_blob_endpoint log_analytics_workspace_id = data.azurerm_log_analytics_workspace.law.id name = "sql-${var.env}-${var.region_primary}" resource_group_name = module.rg_01.name[0] storage_account_id = data.azurerm_storage_account.storage.id tags = local.tags }
Error: Error: Provider produced inconsistent final plan
When expanding the plan for module.sql_01.azurerm_monitor_diagnostic_setting.diag to include new values learned so far during apply, provider "registry.terraform.io/-/azurerm" produced an invalid new value for .log: planned set element cty.ObjectVal(map[string]cty.Value{"category":cty.UnknownVal(cty.String), "enabled":cty.UnknownVal(cty.Bool), "retention_policy":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"days":cty.UnknownVal(cty.Number), "enabled":cty.UnknownVal(cty.Bool)})})}) does not correlate with any element in actual.
Versions: TF 0.12.24 Azure 2.5.0
I am also running into this exact same issue on Terraform v0.12.26
Since this issue has been reported a long time ago and relates to the version of provider we no longer support - I'm going to close it. Please open a new updated bug report on current versions of terraform and provider if this is still relevant. Thank you.
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Terraform (and AzureRM Provider) Version
1.44.0
Affected Resource(s)
azurerm_XXXXX
Terraform Configuration Files
I have a sub module embedded which calls diagnostic setting data source, based on the module resource id, the diagnostic setting (sub module) will add logs and metrics.
Debug Output
Error: Provider produced inconsistent final plan
When expanding the plan for module.nw_storage_example.module.diagnostics.azurerm_monitor_diagnostic_setting.diagnostics["stg_0"]
to include new values learned so far during apply, provider "registry.terraform.io/-/azurerm" produced an invalid new value for .log: planned set element cty.ObjectVal(map[string]cty.Value{"category":cty.UnknownVal(cty.String), "enabled":cty.UnknownVal(cty.Bool), "retention_policy":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"days":cty.UnknownVal(cty.Number), "enabled":cty.UnknownVal(cty.Bool)})})}) does not correlate with any element in actual.
This is a bug in the provider, which should be reported in the provider's own issue tracker.
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
0000