0

My yaml pipeline is working fine which perform terraform install, init, validate, plan and apply if the changes are commit to main branch.

Here, i am trying to execute the terraform apply only if the commit happens in main branch, tried to set pipeline trigger but failed

Willing to implement PR stuff.

trigger:
  batch: true
  branches:
    include:
      - main
      - feature/*
pool:
  vmImage: 'vm'

stages:
- stage: TerraformPipeline
  jobs:
    - job: AKSDeploymentViaTerraform
      continueOnError: false
      steps:
      - task: PublishPipelineArtifact@1
        displayName: Publish Artifacts
        
      - task: TerraformInstaller@0
        displayName: Terraform Install
        
      - task: TerraformCLI@0
        displayName: Terraform Init
        
      - task: TerraformCLI@0
        displayName: Terraform Validate 
        
      - task: TerraformCLI@0
        displayName: Terraform Plan
        
      - task: TerraformCLI@0
        displayName: Terraform Apply
~~~

0 Answers0