so far i've just been using functions for everything but recently am looking into component resources. is there a recommended way to handle breaking up the code in a component resource so i don't have a (for example) 3000 line constructor?
08/31/2022, 4:38 AM
Treat it as you would any other OO class. You want cohesion, SOLID, all the usual good stuff.
If you want to set up your database with AWS backup, and a native backup to a common backup S3 bucket, then set up RDS and AWS Backup in the constructor. Don't set up the S3 bucket, pass that in as a parameter. It's all fairly intuitive.
Also design everything to be unit testable. Component Resources' winning feature (for me) is that it lends itself to TDD in a way that almost nothing else in IaC does.
09/01/2022, 11:27 AM
@little-cartoon-10569 do you have any examples you can share? My experience of writing tests for Pulumi code has been frustrating at best, so I'd love to see some that are working well for people.