sparse-intern-71089
03/09/2023, 6:53 PMclever-sunset-76585
03/09/2023, 7:19 PMexamples
repo. Have you looked there? This is probably a good one to look at. It uses ComponentResources
; not that you must also encapsulate yours as components: https://github.com/pulumi/examples/tree/master/aws-ts-wordpress-fargate-rds
I also have a couple of examples of my own that may be quite large to read through but may give you a general idea: https://github.com/cloudy-sky-software/FoldingInTheCloud, https://github.com/cloudy-sky-software/botpress-pulumi
I'd like to verify what I think of as idiomatic TypeScript the preferred approach of the Pulumi community.What are you looking to verify? 🙂
quaint-twilight-92541
03/09/2023, 7:39 PMindex.ts
...
I'm trying to verify/refute an approach that uses top-level TS code in imported files, then simply references something exported so the transpiler won't throw away the require. This feels non-idiomatic to me, and largely side-effect driven. And, I don't see that pattern in these examples.clever-sunset-76585
03/09/2023, 7:48 PMquaint-twilight-92541
03/09/2023, 8:03 PMclever-sunset-76585
03/09/2023, 8:54 PMso exports in top-level code in other files don't result in stack outputs; one would need to "re-export" from index, correct?I believe so, yes.
I guess I'm just trying to take an idiomatic TS approach and not foul the waters with style questions. Unfortunately, JS/TS is full of such things because it is so permissive (but golang is a bit too unweildly for IaC IMHO).To be fair, I think it is idiomatic for infrastructure code to have resources created through the side-effect import due to its imperative nature. However, if you are dealing with a large/rapidly growing codebase, that's probably not ideal. Or if you are writing a library for IaC resources, you should use component resources anyway.