Try adding a step to install Terraform
in the second stage - Terraform Apply
as well. Your code only installs it in the first stage.
Since the second stage is a Deployment
stage you should add a step to explicitly checkout your repo.
- task: TerraformInstaller@1
inputs:
terraformVersion: 'latest'