sparse-intern-71089
04/07/2023, 10:27 AMlimited-rainbow-51650
04/07/2023, 10:49 AMResourceOptions
(plural). In Go, we were able to leverage the variadic functions
feature indicated by the 3 dots. This means, you can pass every ResourceOption
(singular) individually, one after the other separated by comma's.
See this Go example on variadic functions.adorable-scooter-32619
04/07/2023, 2:35 PMpulumi.ResourceOptions
? From the python code, we could simply pass a variable via opts
to own classes, use that opts directly and then change it to use it in their sub/child ressources. If we use []pulumi.ResourceOption
, I see no direct way to simply change one of the resourceOption without replacing everything or know the slice index for every part (parent, depends_on, etc..).
Do you have some hints where i can find real pulumi configs in go that use the resourceOption with different parents or how pulumi.ResourceOptions
are used correctly?
Thanks :)incalculable-parrot-23117
04/10/2023, 8:39 PM[]ResourceOption
into a "snapshot" of it so that you can look inside it. You should almost always use ResourceOption
, not ResourceOptions
, unless you need to look inside what a ...ResourceOption
actually means.
For context, the ...ResourceOption
-based API is called a "functional option" in Go. It's a widely used pattern, but it has one major limitation: given opts ...ResourceOption
, nobody except the implementors of the library can see what the opts
mean. The ResourceOptions
type and the accompanying NewResourceOptions
function exist to address this limitation.
We'll try to follow up with an API docs update to clarify this distinction.