Open ssubhro opened 1 year ago
Hello, the reference TerraformOutput.jsonOutputVariablesPath does not seen right. I dont see TerraformOutput as a name of your output step. check syntax at https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-variables-scripts?view=azure-devops&tabs=bash#levels-of-output-variables
I am trying to redirect the output values of outputs.tf file to a different file from the azure-pipelines.yaml. To achieve that I am using an AzurePowershell task on the pipeline yaml. PFB.
**- stage: terraform_output dependsOn: ["infrastructure_creation"] jobs:
foreach($prop in $json.psobject.properties) { Write-Host("##vso[task.setvariable variable=$($prop.Name);isOutput=true]$($prop.Value.value)") } Write-Output $json > $(System.DefaultWorkingDirectory)\ansible-roles\inventory\output.json workingDirectory: '$(System.DefaultWorkingDirectory)/VM' preferredAzurePowerShellVersion: '9.5.0'**
But this isn't working. Getting the below error.
Exception: /home/vsts-agent/ansibleadoagent/_work/_tasks/AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62/5.218.0/InitializeAz.ps1:38 Line | 38 | throw ("Could not find the module Az.Accounts with given version. … |
~~~~~~~~~~~~~| Could not find the module Az.Accounts with given version. If the module | was recently installed, retry after restarting the Azure Pipelines task | agent.To check if the script is correct or not I tried by echoing "Hello-World" to the required file. Even though the stage was successful, the output.json file never got modified/updated.
Inline: | Write-Output "Hello-World" > $(System.DefaultWorkingDirectory)\ansible-roles\inventory\output.json
Need help on resolving this particular issue.