Search code examples
pulumi

In pulumi, how can I get the fully qualified resource type name?


I'd like to be able to generate an urn based on the current stack, project and resource type. This would be handy when renaming resources, where the aliases options requires a full urn to make the link between resources.

I've got the following:

`urn:pulumi:${pulumi.getStack()}::${pulumi.getProject()}::kubernetes:storage.k8s.io/v1:StorageClass::cluster-enable-ssd`

I'd like to generate the kubernetes:storage.k8s.io/v1:StorageClass part given an arbitrary pulumi Resource class, e.g. in this case k8s.storage.v1.StorageClass. The Resource class itself has name on it, but that only returns StorageClass.

Is there any way to get the global, unique identifier for a pulumi Resource type?


Solution

  • It's a bit hacky but you can get it like this (in Node.js):

    (k8s.storage.v1.StorageClass as any).__pulumiType