This message was deleted.
# aws
s
This message was deleted.
l
The name change is happening because Pulumi thinks you're creating a new resource (IAM group) instead of using the one you just imported. There's a few reasons this might be happening. I think the most likely is that your initial attempt to import the group added Pulumi code for you, but didn't add it to your Pulumi state. You need to resolve this: get the state and code to match up.
You can do this by updating your existing code to have the
import
opt, to import the group and link it to the code; or you can remove the code and import it again in the original way.
You may want to look at your state to see what's in there, it might help you get a picture of what's going on. You can export the state to JSON and review it, but I think an easier option in this case would be to run
pulumi preview --show-sames
g
After posting I found one stackoverflow question and notice that I don't force the name in the group definition So I update the call to:
aws.iam.Group(
"app",
name="app",
pts=pulumi.ResourceOptions(protect=True)
)
But still have the same problem now pulumi want to change the name from app-random to "app" but app-random don't exist.
l
You'll need to check what's in code, state and AWS, and figure out which one has to change to make everything line up.
g
Thanks for the fast reply.... I will try your suggestion and post back here.
l
Your latest comment makes me think that the group is imported into state already. So you may want to update the state to be correct, rather than get Pulumi to change AWS, which is what it is trying to do.
To update the state, you can export-edit-import it, or delete the resource from state and re-import it.
1
g
Thank again, I will check how to update the state. Sorry for the not clear question I'm still beginner here, I learn every day.
l
That's fine, we've all been there, and Pulumi is built on some complex ideas. Fortunately it's mostly the same ideas over and over, so once you get used to it, you can solve most problems really quickly.
g
Cool, thanks for the help, I was able to export edit and import, I no more have diff with the group name! 🎉 I found the doc about state and command example on how to import/export. It's pretty simple, I will read again the doc to learn more about. Thank a lot for the help. 🙇 https://www.pulumi.com/docs/intro/concepts/state/#migrating-between-backends
👍 1