This message was deleted.
# dotnet
s
This message was deleted.
b
@late-ability-31616 you need to do the
File.WriteAllText
inside the
Apply
so that the value has resolved
see https://leebriggs.co.uk/blog/2021/05/09/pulumi-apply for a different way of explaining iut
right now you're assigning the variable inside the apply, you need to do the entire operation inside it
l
@billowy-army-68599 Thank you! I tried that but couldn't get it to compile, because File.WriteAllText doesn't return a string:
b
you can change the
Apply
to return a string, but still do some stuff inside the apply, right?
I'm very weak in C# so can't fix it for you
l
I could do something like this:
Copy code
env.Id.Apply(v => { File.WriteAllText(@"env-id.txt", $"env-id = {v}"); return string.Empty; });
b
yup
l
ah okay
k that works, thanks!