This message was deleted.
# typescript
s
This message was deleted.
l
Generally, importing is a once-off process, so you don't (usually) write code for it. Either you use
pulumi import
to put the resource in your state, or you use the import opt in your code for a single run or
pulumi up
, then remove it. Is this the case for your use-case? If it is, you shouldn't need to call getOutput or getOutputValue. Just use
pulumi stack output
to get the value on the console, and write your import code using that.
m
Unfortunately not in this case. We're writing a self-service portal, and we have a use case where a resource being created sometimes have been created manually by some teams beforehand, so we're trying to account for that. In this case an ID for the resource we're importing can be found in a referenced stack, but I'm just not able to retrieve it beforehand since it's in a secret output.
l
Then you'll have to use
getOutput()
. This won't affect the creation of the resource if you're not using this value for the name: outputs can be passed into the constructor's args parameter. Just don't use this value in the name parameter.
Or you could reproduce the code that exports this value. Since the only time it can be important is if the resource is unmanaged, you won't be double-managing the resource: both stacks will have read-only handles on the resource. So it's safe to use the get-code in the current stack.