bored-table-2069102/09/2022, 5:41 PM
and I got an error saying the RDS cluster did not exist. After a while, I figured out it was just using the implicit AWS credentials I have on my machine, which are going to our main account (which doesn’t have this resource in it), as opposed to our prod account. So I created a profile to our prod account (with assume role) and did:
pulumi import "aws:rds/cluster:Cluster" my-rds-cluster "rds-cluster-name"
and then it “successfully” found and imported the cluster. I put it in quotes because it basically imported it under a new provider (I think the default one), which then conflicted with what I had in code so it wanted to re-create it. I manually exported the stack JSON, edited the provider reference, re-imported it and it was happy. With that in mind, my questions: 1. Is it expected that I would need to do something like the
AWS_PROFILE=prod-account pulumi import "aws:rds/cluster:Cluster" my-rds-cluster "rds-cluster-name"
above? Should it not select the provider I have defined in my stack (or ask me which one I want to use)? 2. Is it expected that it imported it into the stack state with a brand new provider that didn’t exist before?
little-cartoon-1056902/09/2022, 8:06 PM
(we also use only non-default providers). I always write the code manually and use the
opt when importing a resource.
is a great shortcut but doesn't save that much time for experienced users. It's often just as fast to write the code by hand and import it. And if the resource is nested inside a component resource (which for me, it always is), then it's faster to do it manually, since I don't have to move the resource and alias it after importing.
bored-table-2069102/09/2022, 8:54 PM
little-cartoon-1056902/09/2022, 8:58 PM
. It's an opt, whose value documented at the bottom of every resource doc page, and which you add during your import run of
, then remove immediately afterwards (so Pulumi doesn't try to import it again).
bored-table-2069102/09/2022, 9:01 PM
careful-oil-5568105/06/2022, 10:09 PM