Enrico
Enrico

Reputation: 3461

Terraform: Code="LinkedInvalidPropertyId" Message="Property id '' at path 'properties.hostingEnvironmentProfile.id' is invalid

Ever since last night I get an error when deploying my web app to azure using Terraform:

Error creating/updating App Service Plan "test-euw-asp" (Resource Group "test-middle-euw-rg"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="LinkedInvalidPropertyId" Message="Property id '' at path 'properties.hostingEnvironmentProfile.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'."

Looks like it is sending an empty "id" in the "hostingEnvironmentProfile" object.

2020-02-25T15:31:56.0433755Z 2020-02-25T15:31:56.041Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4.exe: {"kind":"Windows","location":"westeurope","properties":{"hostingEnvironmentProfile":{"id":""},"perSiteScaling":false,"maximumElasticWorkerCount":1,"reserved":false,"isXenon":false},"sku":{"name":"S1","tier":"standard","size":"S1","capacity":1},"tags":{}}

I did set the provider version to 1.44.0

provider "azurerm" {
  version = "~>1.44.0"
}

My terraform configuration

resource "azurerm_resource_group" "rg" {
    name = var.ResourceGroupNameApp
    location = "West europe"
}

resource "azurerm_app_service_plan" "asp" {
    name = var.asp-name
    resource_group_name = azurerm_resource_group.rg.name
    location = azurerm_resource_group.rg.location
    kind = "Windows"

    sku {
        size = var.asp-sku-size
        tier = var.asp-sku-tier
    }
}

I'm not using the hosting environment anywhere. Anyone having the same issue? I did submit a support ticket on the Terraform github: https://github.com/terraform-providers/terraform-provider-azurerm/issues/5884

But does anyone know a work-around?

Upvotes: 5

Views: 4182

Answers (2)

Enrico
Enrico

Reputation: 3461

So basically this problem is caused by a bug in the provider. A workaround could be to delete everything and re-create it. (as suggested by Rikki) But nothing assures you that you won't run into the same issue again in the future... Also deleting resources is not ideal, certainly not in a production environment...

What I did: I disabled the "terraform apply" step in my release pipeline (because the resources were already created). So we only needed to deploy our app service and update our database.

This issue will only be fixed in the next release. So i'd suggest upgrading to the new version. https://github.com/terraform-providers/terraform-provider-azurerm/pull/5915#issuecomment-594357740

Upvotes: 2

Rikki
Rikki

Reputation: 1239

My temporary solution to get us unblocked was to manually delete the affected resources, then re-run the terraform at 1.44. Luckily this was just affecting our development environment.

This is less than ideal, but if you're totally stuck, and it's safe to temporarily delete your app service, then recreate it, this might help you!

Upvotes: 0

Related Questions