I'm attempting to use stack references in an inlin...
# automation-api
b
I'm attempting to use stack references in an inline program, whilst using the Automation API to deploy the stack but I'm coming across this error*.* I was able to reference the stack via the Automation API via retrieving a remote workspace and calling
GetOutputsAsync()
then passing those to the config of the inline program, but I'd like to clean things up and make the inline program re-useable with the CLI should I need direct pulumi CLI access. Any ideas what the error might be?
b
I use stack refs with automation-api, not inline. What do you mean by retrieving a remote workspace? In stack B when I want to reference stack A I create a StackReference so not really using any automation-api constructs.
b
Yeah that's exactly what I'm doing, but no bueno 😞 Initially, I was using the automation API to retrieve the remote (git) workspace and use the outputs from that for the inline program, but I've changed to using the
StackReference
class (C#)
FYI I've raised an issue for this as I've been able to replicate it with a very basic Pulumi program: https://github.com/pulumi/pulumi/issues/14287
l
Most likely this error means that your automation api program captures a resource from program A in a variable, a map, or a class, and then when you try to run an and update on stack B and reference that resource, you get an error because it is not from the current operation and thus the current pulumi state knows nothing about it.
Saving resources in variables or data structures and trying to reference them across different updates will cause problems.