sparse-intern-71089
07/14/2022, 4:42 AMlittle-cartoon-10569
07/14/2022, 5:23 AMroleAssignment
) is typing is as a string instead of an Output<string>
.little-cartoon-10569
07/14/2022, 5:25 AMOutput<string>
from all string
types, and my guess is that you're picking up on that, and defining the scope
value to have type string
. But it needs to be Output<string>
.
(*: Pulumi states "it's correct by design" but it confuses all newcomers, so I call that a bug.)able-engineer-79880
07/14/2022, 5:50 AMable-engineer-79880
07/14/2022, 11:26 PMpulumi.output(args.scope).apply(v => {
pulumi.log.warn(v)
});
const vnetId = pulumi.output(args.scope).apply(v => {
return `${v}`
})
The apply function makes pulumi wait until the Output variable has a value before it executes the apply on it. This means your code will pause and wait for this to occur when you attempt to reference the variable vnetId.
It's all about parallelism and making pulumi wait until an Output object has a value before you can reference it.
Thanks @steep-sunset-89396 for explaining this to me.
I hope my poor and slightly uninformed explanation helps anyone searching for this.little-cartoon-10569
07/14/2022, 11:28 PMlittle-cartoon-10569
07/14/2022, 11:29 PMsteep-sunset-89396
07/14/2022, 11:32 PMsteep-sunset-89396
07/14/2022, 11:34 PMsteep-sunset-89396
07/14/2022, 11:34 PMsteep-sunset-89396
07/14/2022, 11:35 PMable-engineer-79880
07/15/2022, 12:02 AM