busy-honey-73811
05/10/2021, 12:29 PMdangling
Pulumi resources in my (TypeScript) stacks, resources which are created but not used as input to any other resource and which are neither added to any output nor returned from the main inline function (using the automation api). Looking at many Pulumi examples this seems to be a common pattern. Think of something like this:
function createBucket() {
// Create AWS S3 Bucket but do neither output nor return it. It is also not used
// as input to any other resource.
new Bucket("myBucket", {...});
}
However, rather often I observe that such resources are not created on first stack deployment resp. are delete on later stack updates. It looks like it depends on some “race condition” (timing issue) whether those resources are registered by the Pulumi runtime or not. Usually adding such dangling
resources as dependency to another resource (using dependsOn
), or alternatively making it a stack output resp. returning it from the main inline function resolves that (racy) problem.
Now I am wondering, is this expected behaviour when using Pulumi with TypeScript/NodeJs or is this a bug in Pulumi?cuddly-father-4905
05/10/2021, 1:16 PMbuckets.ts
and then
export * from './buckets';
in index.ts
?busy-honey-73811
05/10/2021, 1:21 PMcuddly-father-4905
05/10/2021, 1:24 PMimport * as buckets from './buckets';
export {
buckets
};
It's not as clean as just re-exporting, but it seems to have resolved this issue for me so farbusy-honey-73811
05/10/2021, 1:40 PMcuddly-father-4905
05/10/2021, 2:01 PMdry-football-2639
05/10/2021, 2:02 PMcuddly-father-4905
05/10/2021, 2:09 PMbusy-honey-73811
05/10/2021, 2:10 PMwhite-balloon-205
05/11/2021, 3:31 AMpreserve
by default for Pulumi projects since these style of side effects are very common in Pulumi programs.We should almost certainly set that toOpened https://github.com/pulumi/pulumi/issues/7017 to track this.by default for Pulumi projects since these style of side effects are very common in Pulumi programs.preserve
busy-honey-73811
05/11/2021, 8:28 AMimportsNotUsedAsValues
to preserve
for my TypeScript stacks.