Hi, anyone trying out Pulumi with GCP data catalog...
# google-cloud
e
Hi, anyone trying out Pulumi with GCP data catalog? I've have troubles importing existing datacatalog entries but getting a reference using getEntry() works just fine. As an example, I have a pubsub topic created by pulumi that is automatically picked up by datacatalog. I can get a reference to that topic using getEnty resulting in:
Copy code
get-o40-entry-export         : {
        integrated_system          : "CLOUD_PUBSUB"
        linked_resource            : "//pubsub.googleapis.com/projects/mathem-m-test/topics/o40-topic"
        name                       : "projects/mathem-m-test/locations/global/entryGroups/@pubsub/entries/cHJvamVjdHMvbWF0aGVtLW0tdGVzdC90b3BpY3MvbzQwLXRvcGlj"
        source_system_timestamps   : {
            create_time: "2022-02-25T17:08:36.192Z"
            update_time: "2022-02-25T17:08:36.192Z"
        }
        type                       : "DATA_STREAM"
    }
Since that datacatalog entry already exists, I want to import it to Pulumi but then I get a response that the resource doesn't exist.
Copy code
pulumi import google-native:datacatalog/v1:Entry o40-entry projects/mathem-m-test/locations/global/entryGroups/@pubsub/entries/cHJvamVjdHMvbWF0aGVtLW0tdGVzdC90b3BpY3MvbzQwLXRvcGlj

=>
 Type                                   Name                Plan       Info
     pulumi:pulumi:Stack                    datapipelines-prod             1 error
 =   └─ google-native:datacatalog/v1:Entry  o40-entry           import     1 error
 
Diagnostics:
  google-native:datacatalog/v1:Entry (o40-entry):
    error: Preview failed: resource 'projects/mathem-m-test/locations/global/entryGroups/@pubsub/entries/cHJvamVjdHMvbWF0aGVtLW0tdGVzdC90b3BpY3MvbzQwLXRvcGlj' does not exist
Should I use a different resource name for the entry? The Entry resource seems to be referenced by a combination of an entry_group_id and an entry_id when using the getEntry function or when creating a custom Entry. Running gcloud data-catalog also returns that entry:
Copy code
gcloud data-catalog entries describe cHJvamVjdHMvbWF0aGVtLW0tdGVzdC90b3BpY3MvbzQwLXRvcGlj --location=global --entry-group=@pubsub

=>
integratedSystem: CLOUD_PUBSUB
linkedResource: //pubsub.googleapis.com/projects/mathem-m-test/topics/o40-topic
name: projects/mathem-m-test/locations/global/entryGroups/@pubsub/entries/cHJvamVjdHMvbWF0aGVtLW0tdGVzdC90b3BpY3MvbzQwLXRvcGlj
sourceSystemTimestamps:
  createTime: '2022-02-25T17:08:36.192Z'
  updateTime: '2022-02-25T17:08:36.192Z'
type: DATA_STREAM
g
Sorry for this one, but we don't support imports with google-native just yet as it's still in public preview (see the note in https://www.pulumi.com/docs/guides/adopting/import/#pulumi-import-resource-operation); that's why there's no import section in the API docs. Mainly the issue in these cases is the API discovery is still changing rapidly enough that development priority is on native creation rather than import. That being said, you can mix google native and google classic just fine, so I'd try importing with classic:
Copy code
pulumi import gcp:datacatalog/entry:Entry o40-entry <name>
Generally, if there's an import section like this in the API docs, you can import it.
e
Thanks @great-queen-39697