skip to Main Content

This is how my terraform template looks like:

resource "azurerm_resource_group" "example" {
  name     = "myAppServiceRG"
  location = var.location
}

resource "azurerm_service_plan" "example" {
  name                = var.servicePlanName
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Linux"
  sku_name            = var.pricingTier
  worker_count        = var.nodesInWebFarm
}
resource "azurerm_linux_web_app" "example" {
  name                = var.appName
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_service_plan.example.location
  service_plan_id     = azurerm_service_plan.example.id

  site_config {
    application_stack {
      docker_image     = var.dockerHubImage
      docker_image_tag = "latest"
    }
  }
}

and the parameters.tfvars file:

location        = "West Europe"
servicePlanName = "someserviceplan"
nodesInWebFarm  = 2
pricingTier     = "P1v2"
appName         = "myuniquelinuxwebapplication"
dockerHubImage  = "DOCKER|mcr.microsoft.com/dotnet/samples:aspnetapp"

But for some reasons, when i try to do terraform apply -var-file .parameters.tfvars i get this error:

Error: creating Linux Web App: (Site Name "myuniquelinuxwebapplication" / Resource Group "myAppServiceRG"): web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=400 — Original Error: Code="BadRequest" Message="The parameter LinuxFxVersion has an invalid value." Details=[{"Message":"The parameter LinuxFxVersion has an invalid value."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"01007","Message":"The parameter LinuxFxVersion has an invalid value.","MessageTemplate":"The parameter {0} has an invalid value.","Parameters":["LinuxFxVersion"]}}]

Does anyone knows why, and how to change this?

2

Answers


  1. It sounds like there’s a mismatch between your Linux service plan and your docker container.

    I think changing the container to be a Linux build will fix it

    The full tags are on this page (scroll down a bit) https://hub.docker.com/_/microsoft-dotnet-samples

    Login or Signup to reply.
  2. Please remove the Docker part from the dockerHubImage and it should work. So it should be something like that:

    dockerHubImage = "mcr.microsoft.com/dotnet/samples:aspnetapp"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search