breezy-table-35227
12/06/2021, 6:30 PMDuring some program executions,can anyone let me know the preferred way to create a resource that depends on an output value? Me and my teammates have been trying for days to create resources without this, and always end up with various errors relating to things being an Output instance (we’re using python if it matters)doesn’t run. For example, it won’t run during a preview, when resource output values may be unknown. Therefore, you should avoid side-effects within the callbacks. For this reason, you should not allocate new resources inside of your callbacks either, as it could lead toapply
being wrong.pulumi preview
red-match-15116
12/06/2021, 6:32 PMapply
. It's possible the errors you are running into is when you try to print
the output?breezy-table-35227
12/06/2021, 6:36 PMred-match-15116
12/06/2021, 6:36 PMwe’d just refit everything to use an apply callback any time an output is usedthat's probably not necessary TBH
breezy-table-35227
12/06/2021, 6:37 PMred-match-15116
12/06/2021, 7:02 PMbreezy-table-35227
12/06/2021, 7:11 PMred-match-15116
12/06/2021, 7:13 PMres1 = MyResource("my_resource", property="blah")
res2 = OtherResource("foo", dependent_property=res1.property)
If you need to transform the output (like add something to the string)
res1 = MyResource("my_resource", property="blah")
res2 = OtherResource("foo", dependent_property=res1.property.apply(lambda x: f"new-string-{x}")
breezy-table-35227
12/06/2021, 7:21 PMprint
suggestion was not far off, Outputs were just being used as an argument to not-a-Resourcered-match-15116
12/07/2021, 3:03 AM