hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

Provider produced inconsistent final plan for Function App #24897

Open crypto-ralph opened 9 months ago

crypto-ralph commented 9 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.7.3

AzureRM Provider Version

3.87.0

Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Terraform Configuration Files

resource "azurerm_linux_function_app" "function_app" {
  name                = "func-${var.service_name}-${var.env}-${var.location_short}-multi-01"
  resource_group_name = azurerm_resource_group.resource_group.name
  location            = azurerm_resource_group.resource_group.location

  storage_account_name          = azurerm_storage_account.storage_account.name
  storage_uses_managed_identity = true
  service_plan_id               = var.service_plan_id # EP1 Service Plan
  https_only                    = true

changed to:

resource "azurerm_service_plan" "service_plan" {
  name                = "funcplan-${var.workload_name}-csi-${var.env}-${var.location_short}-multi"
  resource_group_name = azurerm_resource_group.resource_group.name
  location            = azurerm_resource_group.resource_group.location
  os_type             = "Linux"
  sku_name            = "Y1"
}

resource "azurerm_linux_function_app" "function_app" {
  name                = "func-${var.service_name}-${var.env}-${var.location_short}-multi-01"
  resource_group_name = azurerm_resource_group.resource_group.name
  location            = azurerm_resource_group.resource_group.location

  storage_account_name          = azurerm_storage_account.storage_account.name
  storage_uses_managed_identity = true
  service_plan_id               = azurerm_service_plan.service_plan.id
  https_only                    = true

Debug Output/Panic Output

Provider produced inconsistent final plan

When expanding the plan for
Zmodule.npc_social_insurance_function_app.azurerm_linux_function_app.function_app
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/azurerm" changed the planned action from
Update to DeleteThenCreate.

This is a bug in the provider, which should be reported in the provider's
own issue tracker.

Error: Provider produced inconsistent final plan

When expanding the plan for
module.npc_social_insurance_function_app.azurerm_linux_function_app.function_app
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/azurerm" produced an invalid new value for
.id: was known, but now unknown.

This is a bug in the provider, which should be reported in the provider's
own issue tracker.

Error: Provider produced inconsistent final plan

When expanding the plan for
module.npc_social_insurance_function_app.azurerm_linux_function_app.function_app
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/azurerm" produced an invalid new value for
.kind: was known, but now unknown.

This is a bug in the provider, which should be reported in the provider's
own issue tracker.

Error: Provider produced inconsistent final plan

When expanding the plan for
module.npc_social_insurance_function_app.azurerm_linux_function_app.function_app
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/azurerm" produced an invalid new value for
.storage_key_vault_secret_id: was cty.StringVal(""), but now null.

This is a bug in the provider, which should be reported in the provider's
own issue tracker.

And about 2k more lines of similar error

Expected Behaviour

Function deleted and recreated using new Service Plan

Actual Behaviour

Provider produced inconsistent final plan

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

crypto-ralph commented 8 months ago

Update: When creating it with steps, So first defining new subscription then in second run changing function subscription it worked as intended. Maybe it was just abnormal execution.