mirror of https://github.com/pulumi/pulumi.git
![]() Python resource constructor overloads were recently added that accept a `<Resource>Args` class for input properties, as an alternative to the other constructor overload that accepts keyword arguments. The name of the new args class is the name of the resource concatenated with an `Args` suffix. Some providers (e.g. Kubernetes, Azure Native, and Google Native) have input types with the same name as resources in the same module, which results in two different `<Resource>Args` classes in the same module. When you try to use the new args class with the constructor, e.g.: ```python pulumi_kubernetes.storage.v1.StorageClass( resource_name='string', args=pulumi_kubernetes.storage.v1.StorageClassArgs(...), opts=pulumi.ResourceOptions(...), ) ``` You run into an error, because `pulumi_kubernetes.storage.v1.StorageClassArgs` is actually referring to the existing input type rather than the intended `StorageClassArgs` class for the constructor arguments. Having the duplicate classes hasn't broken existing usage of the input type because we "export" all the input types for a module _after_ all the resources and resource args classes are exported, so the input type just ends up "overwriting" the duplicate resource args class. Other languages don't have this problem because the input type is either in it's own module/namespace (e.g. Node.js and .NET) or a different name is used for the input type (Go). But with Python, the input types and resources are all available in the same module. To address this for Python, when there is an input type in the same module with the same name as the resource, the args class for the resource will be emitted as `<Resource>InitArgs` instead of `<Resource>Args`. |
||
---|---|---|
.. | ||
docs | ||
dotnet | ||
go | ||
hcl2 | ||
importer | ||
internal/test | ||
nodejs | ||
python | ||
schema | ||
docs.go | ||
docs_test.go | ||
utilities.go | ||
utilities_test.go | ||
utilities_types.go |