When to use Component resources? Can anybody advis...
# general
m
When to use Component resources? Can anybody advise on best practices as to when to use Component resources? For example…. (AWS components): • Deploy Transit Gateways into multiple regions (Component resources are not needed) • Creating both of the following - would this be a good use case for a class extending Component resources? ◦ Customer Gateway ◦ Associated Site to Site VPN Gateways Many thanks in advance (still learning Pulumi)
s
If you are used to Terraform, then an answer could be: when in Terraform you would feel the need to create a "Module": https://developer.hashicorp.com/terraform/language/modules/develop If you are not used to Terraform, then an answer could be: when you feel you are either duplicating a lot of code or when some resources need to be carefully configured in order to work as intended. These answers are somewhat vague, but the question is a bit like: when should I split my main() function in multiple functions, and with which criteria? That is, it is a very good question, but, at least in my opinion, it depends on the author experience and tastes. A guideline: DRY is overrated or misunderstood. Favor simplicity instead of dryness at all costs. Hope it helps
m
@straight-beach-79533 That is VERY useful advice… I’ve written a few Terraform modules so that really relates well to me. Thank you VERY much 🙏 I am totally stealing: ‘A guideline: DRY is overrated or misunderstood. Favour simplicity instead of dryness at all costs.’ as it makes so much sense…
s
😊