I would like to use variables in my Azure pipeline yaml to be able to map some values between azure and terraform. Also using extends in my yaml referring to a template in another repo in the project(it contains variables).Now I am getting error in the pipeline that 'variables' is already defined
(This question is already addressed here but could not get a good answer there.Due to lack of points, I could not comment and ask for updates there. Therefore asking again Use variables in azure pipelines yml that extends from template possible?)
pipeline.yaml
parameters:
- name: vm
displayName: Choose a vm
type: string
default: vm1
values:
- vm1
- vm2
- vm3
variables:
${{ each value in parameters.env }}:
TF_VAR_ENV: ${{ value }}
trigger: none
resources:
repositories:
- repository: templates
type: git
name: team-templates
extends:
template: pipelines/templates/pipeline-team-test.yaml@templates
parameters:
stagesVersion: 2
Error in pipeline: __built-in-schema.yml (Line: 40, Col: 11): 'variables' is already defined
expecting: Able to use variables in both template and pipeline yaml. Is this possible??