Azure DevOps Pipeline Variable: tfplan2md_haschanges
When you run tfplan2md in an Azure DevOps pipeline and write the report to a file, you now
automatically get a pipeline variable tfplan2md_haschanges set to true or false — so
downstream steps can gate on whether the Terraform plan actually contains changes.
✨ Features
-
New Azure DevOps pipeline variable — When
--render-target azuredevops(the default)
and--output <file>are both active, tfplan2md writes
##vso[task.setvariable variable=tfplan2md_haschanges]trueor…falseto stdout after the
report is written. -
Filter-aware — The
haschangesvalue reflects the effective change count after any
filters (e.g.--ignore-azure-id-case-changes). A plan where all resources were filtered
out correctly emitsfalse, nottrue. -
GitHub render target unaffected — Running with
--render-target githubsuppresses the
variable emission entirely, so GitHub Actions pipelines see no extra stdout noise.
▶️ Getting started
# In an Azure DevOps pipeline step:
tfplan2md plan.json --output plan.md
# The variable is now set; use it in a downstream step:
# condition: eq(variables['tfplan2md_haschanges'], 'true')Full Azure DevOps YAML example:
- script: tfplan2md plan.json --output plan.md
name: tfplan2md
- task: SomeApprovalTask@1
condition: eq(variables['tfplan2md_haschanges'], 'true')
displayName: 'Approve Terraform changes'