icy-controller-6092
02/21/2024, 1:28 PMicy-controller-6092
02/21/2024, 1:28 PMimport * as pulumi from '@pulumi/pulumi'
const ev1 = process.env['EV1']
const randomprovider: pulumi.dynamic.ResourceProvider = {
create(inputs) {
const ev2 = process.env['EV2']
const id = `${ev1}-${ev2}-${Math.random()}`
return Promise.resolve({ id, outs: {} })
},
delete(id, props) {
const ev2 = process.env['EV2']
console.log('deleting random with id:', id)
console.log('ev1=', ev1, 'ev2=', ev2)
return Promise.resolve()
},
}
export class Random extends pulumi.dynamic.Resource {
constructor(name: string, opts?: pulumi.CustomResourceOptions) {
super(randomprovider, name, {}, opts)
}
}
icy-controller-6092
02/21/2024, 1:30 PMicy-controller-6092
02/21/2024, 1:31 PMconsole.log('ev1=', ev1, 'ev2=', ev2)
when the delete function is run, ev1 will show the old value from the previous run, and ev2 will show the value from the current run