sparse-intern-71089
11/27/2023, 4:30 PMbillowy-army-68599
Setin the model_config to ignore this error or implementarbitrary_types_allowed=True
on your type to fully support it.__get_pydantic_core_schema__
billowy-army-68599
arbitrary_types_allowed = True
dry-keyboard-94795
11/27/2023, 4:39 PMechoing-postman-88590
11/27/2023, 4:42 PMbillowy-army-68599
echoing-postman-88590
11/27/2023, 4:46 PMdry-keyboard-94795
11/27/2023, 4:49 PMechoing-postman-88590
11/27/2023, 4:51 PMgcp.serviceaccount.Account
for this item, etcdry-keyboard-94795
11/27/2023, 4:54 PMechoing-postman-88590
11/27/2023, 4:54 PMdry-keyboard-94795
11/27/2023, 4:56 PMechoing-postman-88590
11/27/2023, 4:58 PMComponentResource
class, I am using pydantic to expand and check and expand from json the args
partgreat-sunset-355
12/05/2023, 8:05 AMoutputs
and other type annotations because Pydantic tries to "execute" the type to check it. arbirary_types_allowed
may work at the beginning but trust me it goes bad relatively fast.
I started with the style of the repository that Jaxx has linked, however, it soon became clear that it has many limits.
At the same time, I had another codebase with TypeScript which has its own quirks but in general it is more pleasant for larger projects. (IMO)
I believe that Pulumi Python will become good once typeddicts are implemented https://github.com/pulumi/pulumi/issues/11732adventurous-butcher-54166
01/23/2024, 3:16 PMol_infrastructure
project and saw how they're using Pydantic.
I went on a similar journey few months back in an effort to standardize config schemas across (Pulumi) projects, resource components etc. and support type hints.
Ended up using dataclasses and created a configuration loader which automatically inspects type annotations and populates the config object from a Pulumi stack config using relevant pulumi.Config
getter functions, with support for:
• Supports various types... strings, int, bool, dict, list, tuple
• Optional (Config.get_x
) and non-optional (Config.require_x
)
• Secrets for all types (Config.get_x_secret
/ Config.require_x_secret
)
• Populating with default values defined int he dataclass schema when a config key is not present in a stack
Sharing some snippets here should anyone be interested in having a look...
https://gist.github.com/olafurnielsen/60f3d8534dfea5007b6ccbf290457f43
I still feel like I haven't cracked this. Was inspired by the way ol_infrastructure used Pydantic for input validation etc. but curious to know the limitations you hit @great-sunset-355
Would also love to discuss this with some clever minds any time 🙂dry-keyboard-94795
01/23/2024, 3:23 PMadventurous-butcher-54166
01/23/2024, 3:24 PMadventurous-butcher-54166
01/23/2024, 3:43 PMdry-keyboard-94795
01/23/2024, 6:33 PMdry-keyboard-94795
01/23/2024, 6:35 PMdry-keyboard-94795
01/23/2024, 6:40 PMadventurous-butcher-54166
01/24/2024, 10:47 AMpulumi_azure_native
provider and most if not all resource components take in keyword arguments but can alse be passed an Args class. I was thinking to align the config schema with those arguments to easily pass them in using same keyword names and structure to reduce the amount of "parameter passing around" in our IaC library...
Also making some experiments with Pulumi ESC, especially excited about the ability to extract stack outputs and have them as direct configuration inputs in another stack.adventurous-butcher-54166
02/16/2024, 11:47 PM