what are the advantages of creating a ComponentRes...
# general
b
what are the advantages of creating a ComponentResource over just creating a function that creates a bunch of resources?
i
code organization/encapsulation
o
@billowy-laptop-45963 fwiw, I started with doing ComponentResources, and switched to writing React like functions that return outputs/resources in a hierarchical object because it made refactoring easier. Moving a resource out of a ComponentResource or moving a resource into it changes the URN, which makes it appear to be a completely new resource
b
@orange-policeman-59119 that's really interesting, do you have an example online somewhere?
I guess that's the advantage when infra is truly code, you have all options open to you
o
@billowy-laptop-45963 I don't, all internal
Like this:
Copy code
// tslint:disable-next-line: max-func-body-length
export const NatsStreaming = (
  name: string,
  namespace: Input<string>,
  config: NatsStreamingConfig,
) => {
  const replicas = config.replicas;
where that stands up a bunch of k8s resources
b
cool, thanks