hallowed-camera-52062
03/30/2021, 12:41 PMconst environmentName: string = pulumi.getStack().toLowerCase()
// Filter the resources that belong to the current environment
const resources: ResourceDefinition[] = resourcesDefinitions.filter(
(r: ResourceDefinition) => r.environment === environmentName
)
if (resources.length === 0) {
console.log(
`There are no resources to be deployed onto the current environment ('${environmentName}').`
)
process.exit(0)
}
resources.map((resource) => {
const getConventionName: ConventionNameGetter = useNamingConvention(
resource.name,
resource.environment
)
provisionResource(resource, getConventionName)
})
I tried implementing this with process.exit(0)
but it seems like it's not a good idea:
The Pulumi runtime detected that 712 promises were still active
at the time that the process exited. There are a few ways that this can occur:
* Not using `await` or `.then` on a Promise returned from a Pulumi API
* Introducing a cyclic dependency between two Pulumi Resources
* A bug in the Pulumi Runtime
Leaving promises active is probably not what you want. If you are unsure about
why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
environment variable. The Pulumi runtime will then print out additional
debug information about the leaked promises.
error: an unhandled error occurred: Program exited with non-zero exit code: 1
Resources:
+ 1 to create
brave-planet-10645
03/30/2021, 12:42 PMhallowed-camera-52062
03/30/2021, 12:43 PMbetter-shampoo-48884
03/30/2021, 12:43 PMbrave-planet-10645
03/30/2021, 12:44 PMhallowed-camera-52062
03/30/2021, 12:44 PMdry-football-2639
03/30/2021, 1:41 PMconst lazyRunner = (resources: ResourceDefinition[]): ResourceOutputs => {
return resources.map((resource) => {
const getConventionName: ConventionNameGetter = useNamingConvention(
resource.name,
resource.environment
)
return provisionResource(resource, getConventionName)
})
}
const environmentName: string = pulumi.getStack().toLowerCase()
// Filter the resources that belong to the current environment
const resources: ResourceDefinition[] = resourcesDefinitions.filter(
(r: ResourceDefinition) => r.environment === environmentName
)
if (resources.length === 0) {
console.log(
`There are no resources to be deployed onto the current environment ('${environmentName}'). Skipping...`
)
}
export const resourceOutputs: ResourceOutputs = (resources.length === 0) ? null : lazyRunner(resources)