Azure & Terraform: The Tiny but Important Difference Between Windows & Linux

As part of the release build of our user group site, we use Terraform to create a BDD environment from scratch, run the acceptance tests and then destroy the environment to keep the cost down. As we recently switched the BDD environment from Windows to Linux, we run into this error:

Error: creating Linux Web App: (Site Name “***” / Resource Group “***”): web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=409 — Original Error: Code=”Conflict” Message=”There was a conflict. AlwaysOn cannot be set for this site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails

Nowhere in our configuration files was anything for AlwaysOn declared, yet our build pipeline failed because our Azure plan was too small for this feature.

It took us a while to find the source of the problem: Terraform sets the value for always_on in a site config by default to true, but only on Linux and not on Windows. That is the reason while this option was active even if we did not set it anywhere in our configuration.

You find this feature in the Terraform documentation:

The documentation explicitly tells us that this option is active by default and that we need to change it for the smaller Azure plans.

We can disable this behaviour by explicitly telling Terraform to set the value for always_on to false:

Should you switch from Windows to Linux you should keep an eye on such tiny differences. They are annoying and hard to find, especially if you come from a running environment and haven’t changed anything besides the operating systems.

1 thought on “Azure & Terraform: The Tiny but Important Difference Between Windows & Linux”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.