https://pulumi.com logo
#typescript
Title
# typescript
e

early-match-56268

06/22/2019, 9:27 PM
hi! Could someone help me figure out how to get resources registered with pulumi? my project is structured like
Copy code
pulumi
├── Pulumi.dev.yaml
├── Pulumi.yaml
├── README.md
├── gcp
│   ├── README.md
│   ├── index.ts
│   └── k8s.ts
├── index.ts
├── k8s
│   ├── index.ts
│   ├── namespace.ts
│   └── secret.ts
├── package-lock.json
├── package.json
└── tsconfig.json
and in the
pulumi/index.ts
Copy code
import * as gcp from './gcp'

export let devKubeconfig = gcp.devKubeconfig
My problem is that none of resources in the
pulumi/k8s/
dir are getting picked up by pulumi when i run
pulumi up
. If I import the resources and then export one of them in the
pulumi/index.ts
then they show up. Trying to figure out what I am doing wrong
c

cuddly-barista-79466

06/24/2019, 3:15 PM
we use this NPM Package for Environment configs within Pulumi https://www.npmjs.com/package/config
And the more specific implementation of it is managed by setting a pulumi config variable on the stack which is used by the NPM Config package referenced here: https://github.com/lorenwest/node-config/wiki/Environment-Variables#node_config_env
g

gentle-diamond-70147

06/24/2019, 4:18 PM
@early-match-56268 you must import your k8s resources from somewhere in your application. They will not automatically be picked up in sub-directories. Also, you must use an exported object otherwise Node will "optimize" it away as unused. This is explained in more detail at https://www.typescriptlang.org/docs/handbook/modules.html#optional-module-loading-and-other-advanced-loading-scenarios.
e

early-match-56268

06/25/2019, 12:44 AM
thanks, did not know about the unused optimization. exporting the resources fixes the issue
👍 1
g

gentle-diamond-70147

06/25/2019, 1:17 AM
It confused me at first too. 🙂
2 Views