I can't create a linux consumption service plan for an azure Function.
This code was deployed and succeded on october 17th but was not working today (october 18th).
Terraform 0.12.9
provider.azurerm v1.35.0
azurerm_app_service_planazurerm_function_appresource "azurerm_app_service_plan" "aws" {
name = "${var.aws_app_service_plan_name}"
location = "${azurerm_resource_group.rg.location}"
resource_group_name = "${azurerm_resource_group.rg.name}"
kind = "FunctionApp"
reserved = true
#Consumption Plan
sku {
tier = "Dynamic"
size = "Y1"
}
tags = "${var.tags}"
}
resource "azurerm_function_app" "aws" {
name = "${var.aws_func_app_name}"
resource_group_name = "${azurerm_resource_group.rg.name}"
location = "${azurerm_resource_group.rg.location}"
app_service_plan_id = "${azurerm_app_service_plan.aws.id}"
storage_connection_string = "${azurerm_storage_account.aws.primary_connection_string}"
https_only = true
version = "~2"
app_settings = {
FUNCTIONS_WORKER_RUNTIME = "python"
...
}
identity {
type = "systemAssigned"
}
tags = "${var.tags}"
}
https://gist.github.com/ecnerual/9792599deb0588443a055cde6bdf7b4b
Should Create a Linux Consumption plan Service Plan
Error: Error creating/updating App Service Plan "aws-security-dev-service-plan" (Resource Group "aws-security-zone-dev-rg"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="The parameter 'SKU' has an invalid value. Details: Dynamic sku is not allowed." Details=[{"Message":"The parameter 'SKU' has an invalid value. Details: Dynamic sku is not allowed."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"01033","Message":"The parameter 'SKU' has an invalid value. Details: Dynamic sku is not allowed.","MessageTemplate":"The parameter '{0}' has an invalid value. Details: {1}.","Parameters":["SKU","Dynamic sku is not allowed"]}}]
terraform applyWe have the same issue. I contacted MSFT about this issue and they referred me to this link saying that when creating Linux Consumption Function App you cannot create the plan separately as it's created automatically and that you need to specify the "kind" and "reserved" as part of the function app resource. https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code#deploy-on-consumption-plan
@GarethBradshaw Thanks for gathering additional information from Microsoft. Do we have an existing solution using the supported configurations within Terraform or do we think this a new feature?
I have contacted Microsoft's support for some help about this issue. There was a bug in their backend and its now Fixed.
Regards!
@ecnerual Were you able then to create a Linux consumption plan resource then? Or do you require Terraform changes to not require a plan in the resource?
@UnoSD I have been able to create a Linux consumption plan resource! I havent modified anything in my code.
This exemple worked for me!
resource "azurerm_app_service_plan" "aws" {
name = "${var.aws_app_service_plan_name}"
location = "${azurerm_resource_group.rg.location}"
resource_group_name = "${azurerm_resource_group.rg.name}"
kind = "FunctionApp"
reserved = true
#Consumption Plan
sku {
tier = "Dynamic"
size = "Y1"
}
tags = "${var.tags}"
}
@ecnerual Thank you for confirming that and sharing the code;
looks pretty much the same as the one I had, I will give it another try later.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
Most helpful comment
@GarethBradshaw Thanks for gathering additional information from Microsoft. Do we have an existing solution using the supported configurations within Terraform or do we think this a new feature?