Open meldonya opened 2 years ago
Ran into this similar issue. Created Action Group in Az Cli as I did not want to hard code multiple email receivers. Then used data call to get action group and used that to create action alert. I ran the same error stated here. I also had 'depends_on' but did not help. The only way to fix is, run only creation of action group and data call in TF and leave the creation of alert commented. Then uncomment and re-run to create alert based on the action group works.
We're having the same issue here. Is there any updates about this?
Yup, running into the same issue.
We are running in to same issue any updates?
Same, still see this problem on Terraform 1.2.4 Azure Provider version 3.12.0
Had a similar issue,
_When expanding the plan for azurerm_storage_account_customer_managed_key.storage_account_customer_managed_key to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/azurerm" produced an invalid new value for .keyversion: was null, but now cty.StringVal("xxxxxxxxxxxxxxxxxx").
Reverting terraform from 1.3.1 to 1.2.8 fixed the issue for me
This is still an issue with
Terraform 1.3.4 AzureRM 3.40.0
Still coming with terraform 1.4.0 and azureRM 3.50.0
For this issue
action {
- action_group_id = "/subscriptions/S/resourceGroups/RG/providers/Microsoft.Insights/actionGroups/AG" -> null
- webhook_properties = {} -> null
}
action {
action_group_id = "/subscriptions/S/resourcegroups/RG/providers/Microsoft.Insights/actiongroups/AG"
}
Workaround:
action {
action_group_id = data.azurerm_monitor_action_group.ag.id
webhook_properties = {
A = "workaround"
}
}
Just add a custom property(s) and this will remove the error reported above.
Can confirm @maltaf1 suggestion for a workaround works to get the TF plan to apply in my specific case
This is still happening in Terraform 1.7.0 and AzureRM 3.61.0 and the @maltaf1 workaround doesn't seem to work for me.
Code -
resource "azurerm_monitor_metric_alert" "alert" { name = var.alert_name resource_group_name = var.rgname scopes = [var.data_source_id] description = var.description
dynamic "action" { for_each = var.monitor_action_group_ids content { action_group_id = action.value } }
enabled = var.override_alert_is_enabled severity = var.override_alert_config.severity frequency = var.override_alert_config.frequency window_size = var.override_alert_config.window_size auto_mitigate = var.override_alert_config.auto_mitigate
criteria { metric_namespace = var.override_criteria_settings.metric_namespace metric_name = var.override_criteria_settings.metric_name aggregation = var.override_criteria_settings.aggregation operator = var.override_criteria_settings.operator threshold = var.override_criteria_settings.threshold }
tags = var.tags }
Error -
Error: Provider produced inconsistent final plan │ │ When expanding the plan for │ module.cosmos_table.module.default_cosmos_alerts.module.low_service_availability.azurerm_monitor_metric_alert.alert │ to include new values learned so far during apply, provider │ "registry.terraform.io/hashicorp/azurerm" produced an invalid new value for │ .action: planned set element │ cty.ObjectVal(map[string]cty.Value{"action_group_id":cty.UnknownVal(cty.String), │ "webhook_properties":cty.NullVal(cty.Map(cty.String))}) 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.
Terraform (and AzureRM Provider) Version Terraform Core version: 1.1.4 AzureRM Provider version: v2.94.0
Terraform Module Configuration Files
Description / Feedback I've successfully applied the above resource, but Terraform reported the following error
The action_group_id is already created at execution time. It only happens when I execute the hole plan and create App Service before the rule. When I only execute it to create the rule it works as expected:
I've tried using dependency when calling the module but I still get the same error