Hi. Is it the responsibility of my program to retu...
# general
Hi. Is it the responsibility of my program to return valid exports for every run of pulumi?
Copy code
package main

import (

func main() {
        pulumi.Run(func(ctx *pulumi.Context) error {
                if os.Getenv("FAIL") == "true" {
                        return errors.New("ERROR")
                ctx.Export("output", pulumi.String("string"))
                return nil
After the first run, I the output is set.
Copy code
Type                 Name                         Status     
     pulumi:pulumi:Stack  pulumi-output-dissapear-dev             

  + output: "string"
With FAIL=true env var my output is disappeared.
Copy code
Type                 Name                         Status         Info
     pulumi:pulumi:Stack  pulumi-output-dissapear-dev  **failed**     1 error

  pulumi:pulumi:Stack (pulumi-output-dissapear-dev):
    error: an unhandled error occurred: program failed:
    1 error occurred:
    	* ERROR

  - output: "string"
Is it desired behavior?
Copy code
[spigell@dragonfish pulumi-output-dissapear ]$ pulumi stack output 
Current stack outputs (0):
    No output values currently in this stack
I would say this is expected- state in pulumi is the result of the procedural run of the program from start to finish. If something is added or removed (eg, the line of code creating a resource or output is removed or otherwise never run), the new state would not have that item, and in this case the diff would show the output being removed.