jason-johnson / azure-pipelines-tasks-terraform

Azure Pipelines extension for Terraform
MIT License
127 stars 55 forks source link

TERRAFORM_PLAN_HAS_DESTROY_CHANGES variable is not being set when there are destroy changes in the plan #280

Closed jmyers82 closed 1 year ago

jmyers82 commented 2 years ago

Describe the bug When using the terraform cli for a plan and adding the -publishPlanResults, followed by a terraform cli show command only populates TERRAFORM_PLAN_HAS_CHANGES variable and not the TERRAFORM_PLAN_HAS_DESTROY_CHANGES variable.

To Reproduce Steps to reproduce the behavior:

  1. Setup pipeline as follows:
    
    - task: TerraformCLI@0
    displayName: Terraform Plan
    inputs:
    command: plan
    workingDirectory: ${{ parameters.working_dir }}
    publishPlanResults: terraform.tfplan
    commandOptions: -lock-timeout 5m  -input=false -detailed-exitcode -out terraform.tfplan

Setup a powershell task and did a get-childitem Env: There is no env var for destroy changes?

TEMP C:\Users\VSSADM~1\AppData\Local\Temp
TERRAFORM_LAST_EXITCODE 0
TERRAFORM_PLAN_HAS_CHANGES true
TF_BUILD True

Expected behavior I expected there to be both variables set to true TEMP C:\Users\VSSADM~1\AppData\Local\Temp
TERRAFORM_LAST_EXITCODE 0
TERRAFORM_PLAN_HAS_CHANGES true
TERRAFORM_PLAN_HAS_DESTROY_CHANGES true
TF_BUILD True

Screenshots If applicable, add screenshots to help explain your problem.

Pipeline Logs Include logs that help demonstrate the problem. Please make sure to redact any sensitive info such as secrets.

Agent Configuration

Additional context

jason-johnson commented 1 year ago

This doesn't work right now. It will be addressed with #285. Closing as a duplicate