Skip to content

Commit

Permalink
Add CustomResourceName to pipeline parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
silversoul93 committed Nov 6, 2024
1 parent 541241c commit 3521e03
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/cmd/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type TerraformRequestBody struct {
DebugMode bool `json:"DEBUG_MODE"`
TerraformAutoApprove string `json:"TERRAFORM_AUTO_APPROVE"`
TerraformAction string `json:"TERRAFORM_ACTION"`
CustomResourceName string `json:"CUSTOM_RESOURCE_NAME"`
} `json:"templateParameters"`
Variables struct {
AzureSubscriptionID struct {
Expand Down Expand Up @@ -93,11 +94,15 @@ func azureTerraformCR(cr CRInfo, user string, password string, variablesContent
repositoryBranchName = "master"
}

customResourcePathParts := strings.Split(cr.Path, "/")
customResourceName := customResourcePathParts[len(customResourcePathParts)-1]

requestBody := TerraformRequestBody{}
requestBody.Resources.Repositories.Self.RefName = "refs/heads/" + repositoryBranchName
requestBody.TemplateParameters.DebugMode = true
requestBody.TemplateParameters.TerraformAutoApprove = terraformAutoApprove
requestBody.TemplateParameters.TerraformAction = terraformAction
requestBody.TemplateParameters.CustomResourceName = customResourceName
requestBody.Variables.AzureSubscriptionID.IsSecret = false
requestBody.Variables.AzureSubscriptionID.Value = azSubscriptionID
requestBody.Variables.AzureTenantID.IsSecret = false
Expand Down

0 comments on commit 3521e03

Please sign in to comment.