0

I have created a new C# Azure Function (EventHub trigger) and added my own logic to handle the events that come in. My issue is that I am not sure how to deploy this new app via terraform. I have created a azurerm_function_app_function resource, and from reading the terraform docs I can see that I can add a file (https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app_function#file) however, for a CSharp project, that's not using csx, I don't see how this can be used.

Is there a way to deploy a C# application using terraform, or should I split these components up, and have terraform create the azurerm_function_app_function and then have a pipeline that uploads my code to the function?

CJW
  • 491
  • 4
  • 17

1 Answers1

1

Full format name of files that use CSX extension is Visual C# Script. Visual C# Script specification was created by Microsoft.You don't have to have everything in a class and method, a csx file is like it's own method, and everything in the file will be executed on start. It also supports some additional directives (like #load to load another script).

There are several scripting engines which are based on it (or on the underneath Roslyn) or at least on the same format, while providing more advanced directives. So, it means a csx file should run on one of the following:

Solution would be instead of .csx file you can use your .cs file while create the azure function. You can use in the below format.

file {
    name    = "run.cs"
    content = file("exampledata/run.cs")
  }

Reference : What are .CSX C# files for?

RahulKumarShaw-MT
  • 3,265
  • 2
  • 4
  • 10