I was wondering if anyone could suggest an improve...
# kubernetes
s
I was wondering if anyone could suggest an improvement on this to import separate files where additional components like namespaces and helm charts are installed:
Copy code
const dependenciesReady = pulumi.all([eksCluster.id, eksNodeGroup.id]).apply(() => {
  require('./system')
  require('./app')
})
in particular I am wondering if there is a better value for
id
since it doesnt seem to promise the objects are in an active or ready state. Other tries I have done that don't work is
Copy code
const dependenciesReady = pulumi.all([eksCluster.id, eksNodeGroup.id]).apply(() => {
  createSystemResources()
  createAppResources()
})
This method ignores the readiness of the of the objects and skips ahead to run the functions before the resources are ready. Also this one that looks appealing but:
Copy code
pulumi.runtime.runInPulumiStack(() => {
  if (eksCluster.status.get() === 'ACTIVE' && eksNodeGroup.status.get() === 'ACTIVE') {
    require('./system')
    require('./app')
  }
})
this locks the stack before any provisioning takes place and is thus useless. Admittedly I have not tried
==
as I assumed it would do the same thing.
d
You can have your eks resources in a file
cluster.ts
, and have your
system
+
apps
files import the resources from there. Your
index.ts
can import everything safely. It's also worth looking into Component Resources, which use classes that you can initialise with dependencies. https://www.pulumi.com/docs/concepts/resources/components/