Hi,
I would like to create an Azure Web App Service, which uses a docker image from an Azure Container Registry.
I am using the following terraform script:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.9.0"
}
}
backend "azurerm" {
resource_group_name = "myproject-westeurope-rg"
storage_account_name = "myprojectsharedstorage"
container_name = "terraform"
key = "admin/terraform.tfstate"
}
}
provider "azurerm" {
features {}
}
locals {
rg-myproject = azurerm_resource_group.myproject.name
location = "westeurope"
}
resource "random_id" "uniqueid" {
byte_length = 4
}
resource "azurerm_resource_group" "myproject" {
name = "myproject-westeurope-rg"
location = local.location
}
resource "azurerm_container_registry" "myproject-acr" {
admin_enabled = true
location = local.location
name = "myprojectacr${random_id.uniqueid.hex}"
resource_group_name = local.rg-myproject
sku = "Basic"
}
resource "azurerm_service_plan" "azappplan" {
name = "azappplan"
location = local.location
resource_group_name = local.rg-myproject
os_type = "Linux"
sku_name = "P1v3"
}
resource "azurerm_linux_web_app" "azapp-docker" {
name = "azapp-docker-${random_id.uniqueid.hex}"
location = local.location
resource_group_name = local.rg-myproject
service_plan_id = azurerm_service_plan.azappplan.id
https_only = true
client_affinity_enabled = true
identity {
type = "SystemAssigned"
}
site_config {
always_on = "true"
#linux_fx_version = "DOTNETCORE|6.0"
application_stack {
docker_image = "DOCKER|${azurerm_container_registry.myproject-acr.login_server}/myimage:latest"
docker_image_tag = "latest"
dotnet_version = "6.0"
}
}
}
resource "azurerm_linux_web_app_slot" "azapp-docker-staging" {
name = "staging"
app_service_id = azurerm_linux_web_app.azapp-docker.id
https_only = true
client_affinity_enabled = true
site_config {
}
}
If I execute that script I get the following error:
Error: creating Linux Web App: (Site Name “azapp-docker-12345678” / Resource Group “myproject-westeurope-rg”): 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”]}}]
If I try to set linux_fx_version I get the following error:
Can’t configure a value for “site_config.0.linux_fx_version”: its value will be decided automatically based on the result of applying this configuration.
Could someone please tell me, what I am doing wrong? I can’t find any missing configurations in the documentation.