This message was deleted.
# general
s
This message was deleted.
l
You can use transformations. Or you can use a single opts template object, and customize it for specific resources when necessary.
The latter is a language-specific solution. It's probably the better option, for languages that make it easy. E.g. in typescript:
Copy code
const baseOpts = { parent: someOtherResource };
...
const resX = new Role("resX", { /* ... */, baseOpts);
const resY = new Bucket("resY", { /* ... */, { ...baseOpts, protect: true });
b
What’s the opposition to using a component?
g
Thanks for the suggestions. I did end up using a component in the end, just not in the way I usually do. I have a method now that creates an “empty” component resource instance with the options I want, and returns
pulumi.Parent(res)
-- so now I can do something like:
Copy code
withCluster := withOpts([DependsOn(cluster), provider])
ResourceX(ctx, name, withCluster)
ResourceY(ctx, name, withCluster, anotherOption)
Which at least saves me a bit of typing, and lets me append additional options to the individual resources easily.