Open charleszipp opened 4 years ago
I'm guessing this is why I'm seeing this?
Evaluating: and(succeeded(), eq(variables['TERRAFORM_PLAN_HAS_CHANGES'], 'true'))
Expanded: and(True, eq(Null, 'true'))
Result: False
yeah i saw that. i'll link the code to this ticket and wait it gets fixed before re-enabling
After a quick look into the azure-pipeline-task-lib repo it does look like functionality was added to the setVariable method to allow output variables starting with version 2.12.0 so it should be possible to implement this natively now. Ref: https://github.com/microsoft/azure-pipelines-task-lib/pull/691
Thanks for pointing this out @OmnipotentOwl!
see PR #31
There would be 2 options - either to add a parameter to switch between variables and outputs - though in that case I would only have one or the other. A better option - in my opinion - would be to use an additional name for the output variables, e.g. to suffix them
It should also be possible to get the output variable of a specific job. For example: I've got a pipeline with multiple generated plans splitted into multiple jobs. AFAIK there's no way to get TERRAFORM_PLAN_HAS_CHANGES from job X.
That feature has been reverted last year and has not been reimplemented, yet or did I miss any parameter to activate it?
Indeed, this would be nice.
I'm resorting to adding a step directly after, that just sets another variable with isOutput=true :(
Hello, Are there any changes in this question? Realy helpful thing)
This is planned but a workaround is shown here .
Set the pipeline variables generated from terraform output to be accessible across multiple jobs within a stage as documented here.
This would require setting the
isOutput=true
flag when setting the variable.Currently the azure-pipelines-task-lib does not provide a means to do this. See this issue. However, if can write the
task.setvariable
command manually to stdout then this should still be possible.This should include the TERRAFORM_PLAN_HAS_CHANGES variable produced when running terraform plan with detailed exit code.