Cannot create resource by Terraform due to invalid name, that is not in fact invalid

Karol Piątkowski 21 Reputation points
2022-01-21T09:29:50.533+00:00

We have a Terraform deployment pipeline that creates new resource group with few resources for each pull request. It was working fine for more than half a year now, but today it fails during adding app services to app service plan with the reason of app name being invalid. The name consists of prefix (that is fixed and has 5 letters), two random words, and service name, separated with hyphen. As an example: "test2-ideal-stingray-backend" or "test2-ideal-stingray-frontend", etc. As mentioned this worked just fine and we put extra care to not violate any naming constrains, but today it fails with following error "Site names only allow alphanumeric characters and hyphens, cannot start or end in a hyphen, and must be less than 64 chars.".

I'm confused and unable to solve this. I've ran Terraform with debug log and this is a direct response from Azure API call to https://management.azure.com/subscriptions/xxx-xxx/providers/Microsoft.Web/checknameavailability?api-version=2021-02-01

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,945 questions
{count} votes

Accepted answer
  1. Haecki 81 Reputation points
    2022-01-22T12:10:20.947+00:00

    The Terraform AzureRM Provider version 2.93 seems to have a bug.

    Try to pin the AzureRM Provider to version 2.92 - which is/was working for me in regards of deploying an App Service.

    Example:

    azurerm = {
      source = "hashicorp/azurerm"
        version = "=2.92.0"
     }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful