1
votes

I am building a ASP.NET application where I need to implement a feature when user clicks a button, I need to trigger a terraform plan and apply. I already have the terraform templates ready. What is the best way to do it? Right now, I am using terraform enterprise which allows me to upload the terraform template to the TF cloud, create a configuration version, create a run, and the deployment runs on TF cloud, all via separate REST API calls. It works, but I don't know if that's the right way. Is it ok to call the terraform command as a separate process from the ASP.NET application like below?

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.CreateNoWindow = false;
    startInfo.UseShellExecute = false;
    startInfo.FileName = "terraform.exe";

and pass arguments for plan/apply. The only problem I am facing with TF enterprise is that it allows only one run at a time. I need to pay more for concurrent runs. I believe the above approach would solve this issue. Any inputs on this would be appreciated. Thanks in advance.

1

1 Answers

1
votes

You can use Tfe.NetClient which is a .NET Client for Terraform Enterprise. https://github.com/everis-technology/Tfe.NetClient