I have the following setup where the first templated job (deploy-infra.yml) runs some terraform jobs which produce some output which are needed in later templated jobs, what I can seem to do is pass this output to other templated jobs, this seems to be because template parameters are determined at compile time not runtime.
Is there a way to do this? This is what I have currently:
- stage: Deploy_Canary
displayName: Deploy Canary
jobs:
- template: deploy-infra.yml
- template: deploy-software.yml
parameters:
dbserver: $[dependencies.DeployInfra.outputs['outputDeployInfra.dbserver']]
deploy-infra.yml produces this as an output which is taken from a powershell script which in turn takes output from a terraform module:
- pwsh: |
echo "##vso[task.setvariable variable=dbserver]$(db.server)"
name: outputDeployInfra
If I echo out parameters.dbserver
in the deploy-software.yml job I just get:
$[dependencies.DeployInfra.outputs['outputDeployInfra.dbserver']]
Any ideas?! Thanks!