millions-pharmacist-62604/05/2023, 10:57 AM
to define args of a
resource, instead of just passing them directly to
? Is there an advantage with this approach over the other? Reference docs: https://www.pulumi.com/registry/packages/aws/api-docs/glue/job/#inputs
great-sunset-35504/05/2023, 11:12 AM
This is a common pattern which helps with testing, etc...
millions-pharmacist-62604/05/2023, 11:14 AM
great-sunset-35504/05/2023, 11:21 AM
millions-pharmacist-62604/05/2023, 11:26 AM
great-sunset-35504/05/2023, 11:40 AM
. Instantiating a class in python is not as elegant as creating an object in JS/TS. Object in JS/TS is more close to Dict in python however, pulumi does not support type discs (yet, there's an issue about it's support). Also note, pulumi has to bend some good practices to make things work, so it may not be obvious why they do things the way they do. I'd suggest reading a smaller project like this https://github.com/pulumi/pulumi-synced-folder/blob/main/provider/cmd/pulumi-resource-synced-folder/s3-bucket-folder.ts#L29 to learn more about how to write pulumi.
millions-pharmacist-62604/05/2023, 11:47 AM
limited-rainbow-5165004/05/2023, 11:55 AM
, followed by
, is that we can make this 3 piece setup (
) to create a resource consistent over the different programming languages. You will see this pattern consistently applied over our supported programming languages and providers.
millions-pharmacist-62604/05/2023, 11:56 AM
great-sunset-35504/05/2023, 11:56 AM
Job("name", prop=val, prop2=val)
- In the beginning I noticed that IDEs did not really work well with the former
Job("name", args=JobArgs(prop=val, prop2=val), opts=ResourceOptions())
limited-rainbow-5165004/05/2023, 11:57 AM
version of the constructor. Given we flatten this via
, it is no longer possible to perform a certain level of type checking, delaying some validation until runtime. It is up to you what you use, but we propose to use the less Pythonic 3-piece constructor if you want a faster development roundtrip.
millions-pharmacist-62604/05/2023, 12:01 PM
limited-rainbow-5165004/05/2023, 12:04 PM
, while I should have said:
a certain level of type checking
a certain level of input validation
version of the constructor doesn't support validating if all required properties are passed, let alone nested properties.
millions-pharmacist-62604/05/2023, 12:07 PM