terraform-provider-azurerm: Cannot make Docker Compose based App Services with new App Service resources
Is there an existing issue for this?
- I have searched the existing issues
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 “me too” comments, 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 Version
1.1.7
AzureRM Provider Version
3.0.2
Affected Resource(s)/Data Source(s)
azurerm_[linux|windows]_web_app
Terraform Configuration Files
resource "azurerm_linux_web_app" "as" {
name = "example"
resource_group_name = "rg-example"
location = "westus2"
service_plan_id = azurerm_service_plan.example.id
site_config {
application_stack {
docker_image = "COMPOSE|${filebase64("example.docker-compose.yml")}"
docker_image_tag = "?"
}
}
}
Debug Output/Panic Output
n/a
Expected Behaviour
Should be able to create a multi-container linux web application based on the provided Docker Compose file
Actual Behaviour
Tries to convert to an invalid linux_fx_version, which spits out the following:
│ Error: creating Linux Web App: (Site Name "as" / Resource Group "rg-example"): 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"]}}]
│
│ with azurerm_linux_web_app.as
│ on sonarqube.tf line 19, in resource "azurerm_linux_web_app" "as":
│ 19: resource "azurerm_linux_web_app" "as" {
│
│ creating Linux Web App: (Site Name "as" / Resource Group
│ "rg-dexample"): 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"]}}]
Steps to Reproduce
No response
Important Factoids
n/a
References
I’m not sure if migrating from azurerm provider from v2 to v3 removed the ability to create multi-container applications, but the previous example of creating these resources don’t seem to work anymore
In v3 when using [linux|window]_web_app, we provide specific docker_image and docker_image_tag values, which are converted into the linux_fx_version field. However there is no COMPOSE option to match against: see here and here.
EDIT: line numbers in second link have changed, here’s the code in question:
if winAppStack.DockerContainerName != "" {
if winAppStack.DockerContainerRegistry != "" {
expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOCKER|%s/%s:%s", winAppStack.DockerContainerRegistry, winAppStack.DockerContainerName, winAppStack.DockerContainerTag))
} else {
expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOCKER|%s:%s", winAppStack.DockerContainerName, winAppStack.DockerContainerTag))
}
}
and
if linuxAppStack.DockerImage != "" {
expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOCKER|%s:%s", linuxAppStack.DockerImage, linuxAppStack.DockerImageTag))
}
The tutorial provided by Azure here doesn’t even list referencing a Container Registry… https://docs.microsoft.com/en-us/azure/app-service/quickstart-multi-container
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 67
- Comments: 25 (8 by maintainers)
Hi, Is there any fix relating to this coming soon?
Thanks @alexgagnon, I’ll check to see how to add the compose option.
@jbowes68 I´m using the Azure/azapi provider to update the deployed resource.
@xiaxyi If possible, do you think you can give us a rough estimate of when the code is ready?
Thanks @alicyn , The fix is included in the mentioned pr, we are doing the internal review, will let you know once the code is ready to be released. Thanks for your patience!
This is a major blocking issue for us as it removes core Azure functionality
Still missing “linux_fx_version” parameter for azurerm_linux_web_app, this parameter was available in the “azurerm_app_service” but that resource is going away in 4.0:
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service.html#linux_fx_version This resource has been deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use azurerm_linux_web_app and azurerm_windows_web_app resources instead.
It is difficult to migrate to the new azurerm_linux_web_app when it does not have feature parity.
Any news on this ? I think still not possible using Compose with new App service resources
@swissbuechi I´m using the regular terraform resource for my destination app service (linux/windows) and through the azapi resource right after with an depends_on = []
But in my case I switched from App Service to Container Instance, as the docker-compose file was way to big for app service . There is an limit of 4k chars.