This message was deleted.
# aws
s
This message was deleted.
l
You can add a Pulumi alias, or you can export the stack, fix the URN and parent links, and re-import. The alias option is easier 🙂 https://www.pulumi.com/docs/intro/concepts/resources/options/aliases/
d
ahh
l
Our you could remove the resource from the state and import it in the new location (which is essentially the export/edit/import option, but safer).
d
Is there a way I can find the old urn? It seems to have disappeared from the stack’s list of resources even though it never deleted it
l
Export the stack and search for it
It'll probably have a
delete: "true"
option.
Which is why you can't see it in the normal output.
d
Our you could remove the resource from the state and import it in the new location
^ how would this look?
l
pulumi state delete resourceUrn
Then either
pulumi import
or write the code yourself, and add the
import:
opt.
d
ahh ok
Hmm weird, I’m not seeing the resource
in the exported stack
Maybe it did get deleted from the pulumi state…
ohh crap, it was in a different stack! 🤦🏽‍♂️
sorry!
So now that I’ve found it, I could do what you said and delete it from the state of that stack and import it into the new one?
l
Yes, certainly. And you can import it in the right place. Since it's in a ComponentResource, I wouldn't use
pulumi import
(unless it can handle that? Not sure...). You can write the code yourself and use the
import
opt.
d
https://www.pulumi.com/docs/intro/concepts/resources/options/import/ what would the resource id be for this IAM role?
l
Have a look at the doc page for the resource, the info is near the bottom of the page.
d
from the stack where it’s living, it seems like it’s the role name
yup, right?
l
That's the Pulumi id. You need to use the AWS ID, which might be anthing. Sometime they're weird composite string.
Ah yes, it is the name then. It always pays to check.
d
Why isn’t it the… ARN?
l
You'll have to ask the AWS API developers 🙂
It's not a Pulumi thing.
d
haha
cool cool, thank you so much
👍 1
actually one question: can two distinct pulumi stacks manage the same resource? If not, will Pulumi stop you from trying?
l
They can but they shouldn't, because of drift. However, you can use the
.get()
class method (https://www.pulumi.com/registry/packages/aws/api-docs/iam/role/#look-up) to get a read-only version of the resource in the project you don't want to manage it.
(This wouldn't generally apply to two different stacks in the same project; it's almost always an inter-project thing.)
d
ah so they’ll just compete with each other to manage that resource?
l
Yes.
d
kk I was going to import as we talked about but realized I hadn’t deleted it from the other stack and it got me wondering…
just confirming… this just deletes the pulumi state and it does not affect the underlying AWS resource, right?
l
It's
pulumi state delete
? Yes, that does not affect AWS, only the Pulumi state file.
d
kk the message from
protect
still applies to the state
l
Yes. You can remove the
protect
via an up (which will also do nothing to AWS), then remove the resource from state.
d
thank you again!!
👍 1