https://pulumi.com logo
#dotnet
Title
# dotnet
f

flaky-school-82490

12/12/2021, 4:16 PM
Is there a way to prevent pulumi from updating an Output if it has already been set?
public MyStack()
{
// only do this if MyOutput has not been set by a previous deployment
MyOutput= MyValue;
}
[Output]
public Output<string> MyOutput { get; set; }
t

tall-librarian-49374

12/12/2021, 5:16 PM
This is somewhat against the idea of desired-state. Why do you want this?
f

flaky-school-82490

12/12/2021, 5:23 PM
I am working on an azure B2C tenant stack. I can create the actual B2CTenant resource with Pulumi, but then I have to create resources within the b2c directory through powershell using the az ad and graph apis. After creating those resources, I would like to reinject some of their properties to the B2CTenant stack so I can just use a StackReference to dowstream parts of my infrastructure. My hack is to run pulumi up a first time, run my powershell script, inject the apps properties through pulumi set config, and run pulumi up again.
t

tall-librarian-49374

12/12/2021, 5:27 PM
I still don’t quite get the idea behind that output
f

flaky-school-82490

12/12/2021, 5:40 PM
public MyStack()
{
var config = new Pulumi.Config();
// only do this if MyOutput has not been set by a previous deployment
MyOutput1 = config.Get("MyInputConfig1");
MyOutput2 = config.Get("MyInputConfig2");
} pulumi config set 'MyInputConfig1' 'MyValue' pulumi up // do something manually pulumi config set 'MyInputConfig2' 'MyValue' pulumi up // My problem: MyOutput1 has been cleared up at this point.
t

tall-librarian-49374

12/12/2021, 5:42 PM
why?
😖 1
f

flaky-school-82490

12/12/2021, 8:09 PM
Right, my bad, my manual script was off. Config is naturally persisted.
2 Views