in Webapp/SDAF/Controllers/LandscapeController.cs [243:282]
public async Task<RedirectToActionResult> DeployConfirmedAsync(string id, string partitionKey, Templateparameters parameters)
{
try
{
LandscapeModel landscape = await GetById(id, partitionKey);
string path = $"/LANDSCAPE/{id}/{id}.tfvars";
landscape.subscription_id = landscape.subscription.Replace("/subscriptions/", "");
string content = Helper.ConvertToTerraform(landscape);
await restHelper.UpdateRepo(path, content);
string pipelineId = _configuration["WORKLOADZONE_PIPELINE_ID"];
string branch = _configuration["SourceBranch"];
parameters.workload_zone = id;
PipelineRequestBody requestBody = new()
{
resources = new Resources
{
repositories = new Repositories
{
self = new Self
{
refName = $"refs/heads/{branch}"
}
}
},
templateParameters = parameters
};
await restHelper.TriggerPipeline(pipelineId, requestBody);
TempData["success"] = "Successfully triggered workload zone deployment pipeline for " + id;
}
catch (Exception e)
{
TempData["error"] = "Error deploying workload zone " + id + ": " + e.Message;
}
return RedirectToAction("Index");
}