How do I `pulumi import` a custom resource? The u...
# typescript
How do I
pulumi import
a custom resource? The urn has a
in it, e.g.:
pulumi import 'db$aws:rds/instance:Instance' production-db-instance-rds prod-mariadb
fails with:
Copy code
panic: fatal: A precondition has failed for urn

goroutine 190 [running]:
Can you escape the
same error
I would not expect
to be in the type token — was that in our documentation somewhere?
If so, would love to get that fixed. But I would try without the
and that should work
for reference, this database was created using the custom ComponentResource provided in this example:
For our Disaster Recovery Test, we took a snapshot of our RDS Instance, and copied it to a new region, then created a new RDS Instance in the AWS Web Console with the snapshot. Then we ran our base-infrastructure with everything except the RDS Instance which is a child of the DB ComponentResource. Then tried to import it.
We did find that we can use Pulumi to use a snapshot when creating an RDS Instance, so we’ll take that approach next. However, using this custom ComponentResource has left us feeling like we’ve painted ourselves into a corner a little bit when it comes to importing infrastructure for this particular use case of import which I understand is different than the usual case.
was the easier solution for us.
Thanks for explaining. I think generally speaking, we’ll want to make importing `ComponentResource`s more straightforward. One thing you could try (which is more complex than the
solution you used) would be to use transformations to inject the additional
option into the correct child resources so that the
hydrates correctly
That is an interesting thought. We do have other custom ComponentResources if the need arises.