Monday, 14 March 2022

GitHub actions deployed failing Function

I had provisioned an App Service Plan and Linux Consumption Function using terraform.

Then connected Visual Studio to perform CI/CD with Github actions.

However when it completed it deployed a Function App with no functions.

When the timer ran it also said:



I ended up creating a new one from scratch using Visual Studio to see what was going wrong.

The first thing I noticed was that the failing Function App had a "Deployment Credentials" blade whereas the working one didn't.

This made me suspect that the App Service Plan was different.

Indeed, I then compared the working one to the terraform definition that provisioned the broken one.

Immediately it was obvious that there were substantial differences, including:


The App Service Plan must be set to "FunctionApp", not "Linux".

Setting the Function app kind and os_type probably help too.


Summary

So, the old rules apply for building terraform files. Actually build a working resource first using the Wizards and Visual Studio, then create a Terraform file, import the resource, plan it, and compare the differences until there are none. Then you know you have a working Terraform file.

No comments:

Post a Comment