https://pulumi.com logo
Title
m

mysterious-wolf-74677

10/25/2021, 6:06 PM
So is there a way to "Unimport" a resource? Basically we have service roles that we don't want in the stack anymore because they're not something we manage, seeing as that they're automatically generated. So after having imported them into the Pulumi stack, we want to remove them from the stack but not have them removed from our actual AWS. We can do this manually currently, by removing the code and manually deleting the resources from the stack, but is there anything like an
"unimport"
feature that can simply remove things from the pulumi stack without changing anything in AWS?
r

red-match-15116

10/25/2021, 6:19 PM
We can do this manually currently, by removing the code and manually deleting the resources from the stack,
Just to make sure I’m understanding correctly, you do this by deleting the relevant resources from the state file and reimporting? Or
pulumi state delete
?
m

mysterious-wolf-74677

10/25/2021, 7:00 PM
we don't re-import, we just leave them out of the state file because we don't want them tracked by pulumi anymore.
which is what I'm hoping the
"unimport"
feature might do, basically remove it from the stack but not AWS
We don't have a need to manage service-linked roles, so we're trying to remove them from IAC to reduce clutter basically
r

red-match-15116

10/25/2021, 7:39 PM
we don’t re-import
Right I meant re-import the state file, not the resource.
But yeah, there is no
unimport
feature. I think there is an open issue for the functionality you’re describing though, but I can’t think of it off the top of my head.
s

steep-toddler-94095

10/25/2021, 11:12 PM
are you sure? I think
pulumi state delete
does exactly this - removes a resource from Pulumi state without touching it in the cloud.
r

red-match-15116

10/25/2021, 11:20 PM
Heh, you’re right @steep-toddler-94095 - I would think that meets the need but it does still require you to remove the code from your program 🤷🏽
m

mysterious-wolf-74677

11/03/2021, 2:37 AM
ok great! @steep-toddler-94095 /@red-match-15116 thank you both!