https://pulumi.com logo
#getting-started
Title
# getting-started
r

rich-agency-75207

08/02/2022, 3:40 PM
Hi All. Has anyone had any success importing pre-existing active GCP resources into their Pulumi stack? I've tried various documented methods without success so far. E.G.
error: Preview failed: unrecognized resource type (Read): gcp:compute:Instance
Am probably missing something obvious. I've tried with stacks configured with
gcp-python
and
google-native-yaml
templates.
l

limited-rainbow-51650

08/02/2022, 4:04 PM
Hello @rich-agency-75207, for each resource type, you can find in the API docs how to import it into your state file. The Pulumi CLI will usually also tell you which code snippet you need to add to your program as well. For your compute instance, have a look here: https://www.pulumi.com/registry/packages/gcp/api-docs/compute/instance/#import
r

rich-agency-75207

08/02/2022, 4:07 PM
@limited-rainbow-51650 👍 - was missing something obvious. That also explains another error concerning a missing self-link. Thanks.
l

limited-rainbow-51650

08/02/2022, 4:08 PM
Here is a blog article which sketches the usual import mechanism: https://www.pulumi.com/blog/pulumi-import-generate-iac-for-existing-cloud-resources/ which was updated in a more recent Pulumi version: https://www.pulumi.com/blog/changes-to-import/
1
3 Views