https://pulumi.com logo
Title
a

able-doctor-68496

10/01/2021, 4:13 PM
Hi there - I’m really trying to wrap my head around the 
props
 argument to the 
ComponentResource
 constructor: https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1 My main questions about it are: • When would I want to pass something to this 
props
 argument? • What would I pass to that argument? For example, currently I’m passing a Kubernetes namespace to a “parent” 
ComponentResource
 that I’ve created. I’m passing it like so:
def __init__(..., namespace: Namespace, ...):
  super().__init__(
    ...,
    props={'namespace': namespace},
    ...
  )
Is that the correct way to use 
props
? My thinking was that this would let the Pulumi “engine” know that there is an ordering requirement between the namespace and my 
ComponentResource
. Is that how it works? If not, then what are 
props
 for?
g

great-sunset-355

10/05/2021, 12:47 PM
I think there is actually an error in Docs. Afaik resource
__init__
can take
args
or arguments directly
def __init__(__self__,
                 resource_name: str,
                 args: Optional[ZoneArgs] = None,
                 opts: Optional[pulumi.ResourceOptions] = None):
args
is later in the code assigned to
__props__
I have a feeling that
props
argument name came from JS/TS in this case and therefore is a typo in docs. As for the usage of props, here is an example.
# with props
route53.Zone(
    args=route53.ZoneArgs(name="<http://example.com|example.com>")
)
# without props
route53.Zone(name="<http://example.com|example.com>")
@billowy-army-68599 Could you please verify the correctness of my statement, we could then fix the docs together. Thank you!
b

billowy-army-68599

10/05/2021, 4:35 PM
i'm not actually sure myself, could you open an issue in pulumi/docs and I'll have someone verify it @great-sunset-355
👀 1
g

great-sunset-355

10/06/2021, 6:51 AM
@billowy-army-68599 there you go: https://github.com/pulumi/pulumi-hugo/issues/684
r

red-match-15116

10/06/2021, 5:27 PM