Azure / terraform-provider-azapi

Terraform provider for Azure Resource Manager Rest API
https://registry.terraform.io/providers/Azure/azapi/latest
Mozilla Public License 2.0
173 stars 47 forks source link

Error: Provider produced inconsistent final plan #472

Open aravindmetla opened 4 months ago

aravindmetla commented 4 months ago

we are using below module to create api connection for sendgrid

terraform { required_providers { azapi = { source = "Azure/azapi" } } required_version = ">= 0.14" }

resource "azapi_resource" "api_connecton_sengrid" { type = "Microsoft.Web/connections@2018-07-01-preview" name = "${var.project_name}-sendgrid" location = var.location parent_id = var.parent_id schema_validation_enabled = false tags = { project_name = var.project_name }

body = jsonencode({ properties = { api = { displayName = "SendGrid", id = "/subscriptions/${var.subscription_id}/providers/Microsoft.Web/locations/${var.location}/managedApis/sendgrid" } displayName = "SendGrid", parameterValues = { apiKey = "${var.sendgridApiKey}" }, } }) }

above module is refered in while creating api connection as below

module "send_grid_api_connection_ais" { source = "../modules/api_connection/sendGrid" project_name = "ais" location = var.location parent_id = azurerm_resource_group.services.id subscription_id = var.subscription_id sendgridApiKey = data.azurerm_key_vault_secret.sendgrid_apikey.value }

when we do terraform apply we are receiving below error

**Error: Provider produced inconsistent final plan

When expanding the plan for module.send_grid_api_connection_ais.azapi_resource.api_connecton_sengrid to include new values learned so far during apply, provider "registry.terraform.io/azure/azapi" produced an invalid new value for .removing_specialchars: was cty.False, but now null.

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

ms-henglu commented 4 months ago

Hi @aravindmetla ,

Thank you for taking time to report this issue and apologize for the trouble!

Would you please try to run terraform plan command again and see if there's any changes or errors? And would you please also share the terraform version you're using? Thanks

aravindmetla commented 4 months ago

Using terraform v1.3.5. Plan executed successfully. Fixed issue by pointing the version of azapi to "1.12.1" in the above module.

below is the changelog from terraform plan on the resource send_grid_api_connection_ais

module.send_grid_api_connection_ais.azapi_resource.api_connecton_sengrid will be updated in-place ~ resource "azapi_resource" "api_connecton_sengrid" { ~ body = (sensitive value) -> (sensitive value) id = "/subscriptions/de4a72fe-316a-4f9c-b37f-c8bcd00a457f/resourceGroups/ais-sit-rg-services/providers/Microsoft.Web/connections/ais-sendgrid" name = "ais-sendgrid" ~ output = jsonencode({}) -> (known after apply)

ms-henglu commented 3 months ago

Hi @aravindmetla , thanks for the details.

This issue could be resolved with the latest Terraform. Please try to use the latest Terraform.