https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

07/28/2023, 5:06 PM
Good morning! Is is possible to hook into Pulumi and throw an error when a certain key is not passed to a component? e.g., I’d like to throw an error if a component does not explicitly pass a the
provider
key.
s

stocky-restaurant-98004

07/28/2023, 6:39 PM
You want to make
resourceOptions.provider
required in a ComponentResource?
If so, I would just validate this in the constructor.
f

full-dress-10026

07/28/2023, 8:59 PM
I want to make it required for all pulumi calls.
Any call to any Pulumi component in my code must pass the resourceOptions.provider.
s

stocky-restaurant-98004

07/31/2023, 4:43 PM
You might be able to do it with a policy pack. You might also be able to make a class that inherits from ComponentResouce that throws an exception if it’s not defined.