https://pulumi.com logo
Title
l

limited-rainbow-51650

03/23/2021, 5:20 PM
I have a GCP
BackendConfig
CRD generated via
crd2pulumi
. But after creating an instance of it, I can’t refer to
crdInstance.metadata.name
. It errors with:
Property 'name' does not exist on type 'OutputInstance<ObjectMeta | undefined>'.
In the generated code, this
ObjectMeta
is defined as:
export type ObjectMeta = k8s.types.input.meta.v1.ObjectMeta;
Am I missing something here?
Why is the
metadata
member of the
BackendConfig
class generated like this?
public readonly metadata!: pulumi.Output<ObjectMeta | undefined>;
Looking at e.g. the Kubernetes
Service
class, the
metadata
member is this:
public readonly metadata!: pulumi.Output<outputs.meta.v1.ObjectMeta>;
If I drop the
undefined
from the generated type definition, my code works correctly. Should I file a Github issue for this?
g

gorgeous-egg-16927

03/23/2021, 11:37 PM
Yes, that seems like a bug. Every k8s resource will include a
.metadata
field, so
| undefined
doesn’t make sense.
👍🏼 1
l

limited-rainbow-51650

03/24/2021, 7:13 AM