Hi :wave: using `CustomResource` in python and th...
# kubernetes
g
Hi 👋 using
CustomResource
in python and the doc states that
inputs properties are implicitly available as output properties
but how to access them?
cr.__getattribute__('metadata')['name']
seems to work but not sure if that's quite correct in regards to being an output
s
What are you doing with CustomResource?
Unfortunately, there's ambiguity in our naming:
kubernetes.apiextensions.CustomResource
is a CRD.
pulumi.CustomResource
is the base class for any resource managed by Pulumi
g
That's a kubernetes CRD in this case, just like the doc i linked, the actual kind doenst really matter I believe as the behaviour is the same with any
s
Ok, so what the docs mean here is that in input (something you can specify or is required like
kind
in this case) can also available as an output. Sometimes the default value will be set by the cloud API, it may not be known until after the resource is created.
If you're working with CRDs, you may want to instead specify in YAML and use crd2pulumi, which will generate a strongly typed class in whatever language you're using: https://www.pulumi.com/blog/introducing-crd2pulumi/
g
looks nice but that means the doc is wrong, right? i was just trying to access
metadata
which is a default inputs, thanks anyway, my ugly hack seems to be working fine so i ll stick with it for now
s
custom_resource.metadata
should definitely be there. I am not sure if you need
custom_resource.metadata.name
or if you need an
apply
to get
name
.