In my Pulumi Python code, I have the following `in...
# general
g
In my Pulumi Python code, I have the following
input_type
classes:
Copy code
@pulumi.input_type
class SftpHomeDirectoryArgs:
    def __init__(
        self,
        *,
        bucket_name: str,
        bucket_path: str,
        entrypoint: str = "/",
        bucket_kms: Optional[pulumi.Input[str]] = None,
    ):
        ...

@pulumi.input_type
class SftpUserArgs:
    def __init__(
        self,
        *,
        username: str,
        home_directory: SftpHomeDirectoryArgs,
        ssh_key: Optional[str] = None,
        password_login: bool = False,
    ):
        ...
Since
bucket_kms
in
SftpHomeDirectoryArgs
is defined as
pulumi.Input[str]
, should
home_directory
in
SftpUserArgs
also be declared as
pulumi.Input[SftpHomeDirectoryArgs]
? Or is it fine as it is? Thanks!
e
I think either should work
g
Both approaches work, but is there a best practice or recommendation for cases like this? Specifically, in my example, is there any difference between declaring:
Copy code
home_directory: SftpHomeDirectoryArgs
vs
Copy code
home_directory: pulumi.Input[SftpHomeDirectoryArgs]
Would explicitly wrapping it in
pulumi.Input
provide any benefits, such as better handling of dependencies or asynchronous values?
e
it would mean that the other parts of home_directory (i.e. name, path, entrypoint) could be defined with input values, but we don't generally nest input values We generally don't nest input values, so if the leaf field has it you probably don't need the parent field to have it as well
g
Thanks!