terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
Requested feature is not available in resource group ...... Please try using a different resource group or create a new one. When creating a FunctionApp plan
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform CLI and Terraform AWS Provider Version
Terraform version: 0.14.3
version = "=2.41.0"
Affected Resource(s)
- FunctionApp service plan
Terraform Configuration Files
resource "azurerm_app_service_plan" "plan" {
name = "${module.global_variables.applicationName}-plan-${var.environment}"
location = azurerm_resource_group.resourcegroup.location
resource_group_name = azurerm_resource_group.resourcegroup.name
kind = "Linux"
reserved = true
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service_plan" "planfunction" {
name = "${module.global_variables.applicationName}-planfunction-${var.environment}"
location = azurerm_resource_group.resourcegroup.location
resource_group_name = azurerm_resource_group.resourcegroup.name
kind = "linux"
is_xenon = false
reserved = true
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service_plan" "planfunctionconsumption" {
name = "${module.global_variables.applicationName}-planfunctioncons-${var.environment}"
#name = "ASP-NLDISDocumentMiningdev-bcfb"
location = azurerm_resource_group.resourcegroup.location
resource_group_name = azurerm_resource_group.resourcegroup.name
kind = "FunctionApp"
reserved = true
sku {
tier = "Dynamic"
size = "Y1"
}
}
Debug Output
Error: Error creating/updating App Service Plan "NLDISDocumentMining-planfunctioncons-dev" (Resource Group "rgname"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Requested feature is not available in resource group rgname. Please try using a different resource group or create a new one." Details=[{"Message":"Requested feature is not available in resource group rgname. Please try using a different resource group or create a new one."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"59324","Message":"Requested feature is not available in resource group rgname. Please try using a different resource group or create a new one.","MessageTemplate":"Requested feature is not available in resource group {0}. Please try using a different resource group or create a new one.","Parameters":["rgname"]}}]
on appservice.tf line 28, in resource "azurerm_app_service_plan" "planfunctionconsumption":
28: resource "azurerm_app_service_plan" "planfunctionconsumption" {
Expected Behavior
I'm trying to deploy a consumption based FunctionApp on Linux. If I manually create this FunctionApp with a service plan inside this resource group, everything works fine. However when deploying this with Terraform it fails with the above error.
I'm also missing some documentation regarding the different kinds of AppService plans. I would expect some kind of matrix with operating system, consumption/non consumption based, app service/function. There's definitely some information on there but it's not clear for example on how to create a function app for linux on a consumption plan.
References
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_plan
As a suggestion, try importing your manually created consumption plan and see if it differs. I think there is also still some issues regarding Windows vs Linux ASPs being in the same resource group, depending on Azure region, so you might want to check that.
I tried that and when I did it deployed successfully without any changes being made to the plan in question.
I think, this is not a bug of the provider itself, but rather an issue with Azure: https://github.com/Azure/Azure-Functions/wiki/Creating-Function-Apps-in-an-existing-Resource-Group
I think your issue happens because it creates the Non-Dynamic service plans first, and then fails to create the Dynamic one because of this.
I found that if you create the Dynamic plan first and then the Non-Dynamic ones, it works.
https://github.com/Azure/Azure-Functions/wiki/Creating-Function-Apps-in-an-existing-Resource-Group
Hello @ditost ,
I am facing the same issue and the proposed solution creating first the consumption plan and then the standard plan it does not work unfortunately.
I was wrong. If we add an explicit dependency it works. Thanks for the tip.