is it possible to alias a resource to another reso...
# typescript
is it possible to alias a resource to another resource that used to be part of a
? basically I have an S3 bucket inside a
however I now want to refactor this template and move the bucket out of the component resource, but i don't want to replace the actual resource in AWS. is this possible? I basically removed the entire component resource from my code, copy-pasted just the bucket resource into the template. I've then set a few variations of
on the resource but each time i run
pulumi up
it's seeing them as two different resources. I feel like maybe i'm just not providing the right alias but just wanted to check if this was actually possible
Sure. You can use
pulumi stack rename
pulumi stack rm
followed by an import.
You're looking to rename it "up" a few levels. Have a look at its original URN (
pulumi stack export
) and URNs near where you want it to end up. The changes should be fairly straightforward.
Not really a #typescript question.. kind of #general I think?
(The advantage of the
then import is that it's easy to add the alias at the same time.)
do you mean
pulumi state rm
? i dont want to rename or remove the stack, just rename some resources
Yes 🙂 Sorry.
(Bit late here..)
haha, all good
So it would be
pulumi state delete
i want to try and avoid having to delete/reimport but if I can't figure out the alias stuff i guess I can fall back to that
I can't find the command for renaming a resource.. maybe it has to be delete / import.. I thought there was a rename... 😕
The problem with the alias in this situation is that the dependency isn't broken.. you need that if you want to move it out of the component resource.
You can have an alias to the old name, but I don't think you can "just" alias it, you have to rename (= delete/import) it too.
This blog post on alias could help you.
👍 1
i ended up aliasing using the entire URN (rather than parent or type) and that worked exactly how I needed it to. thanks for the help both
👍 1