https://pulumi.com logo
#general
Title
# general
b

breezy-bear-50708

03/02/2022, 9:58 AM
Hello! I think I must be missing something obvious. How does one use
aliases
with multiple stacks in the same project? The URN includes the stack name, so there doesn't seem to be a way to alias something that got moved, at least using URNs. Can't use parent/name since it moved to an earlier component in the dep tree.
b

bored-table-20691

03/02/2022, 10:19 AM
What are you trying to do? Rename a resource within a stack?
b

breezy-bear-50708

03/02/2022, 10:21 AM
I moved a resource from one ComponentResource to another
so in effect, the parent changed
e

echoing-dinner-19531

03/02/2022, 10:24 AM
b

breezy-bear-50708

03/02/2022, 11:00 AM
Via the parent you mean? I don't have the old parent - since it is dependent on the new one
e

echoing-dinner-19531

03/02/2022, 11:25 AM
Oh right I see and Alias.Parent wants a URN not a name.
So that's dumb and feel free to raise an issue that Alias objects ought to support parent being just name. For now I think you'd have to construct the URN manually. That shouldn't be too tricky as you can ask for the current stack name with
getStack()
and you've got what the parent URN looks like so if you've got something like: "urnpulumitest_stack:test projectsome type:parent_name" you can just lerp in the result of getStack for the stackname part of the URN and leave the rest as is.
🙌 1
b

breezy-bear-50708

03/02/2022, 2:29 PM
Ah thanks, I'll try that out.
That works. I agree if the parent could just be a name it would be a lot more straightforward.
7 Views