https://pulumi.com logo
Title
a

adamant-author-732

02/08/2023, 10:53 AM
I have a Pulumi resource (A) that emits an
Output[str | None]
and another one (B) that expects an input of
Input[str] | None
. The only way I can think to pass this data from
A
to
B
is via
A.attribute.apply(B(… some arguments here…))
. However, I know that Pulumi discourages creating resources inside an
apply()
. Is there another way to convert
Output[str | None]
to
Input[str] | None
?
e

echoing-dinner-19531

02/08/2023, 11:05 AM
That is very likely a codegen bug... Which resource are you trying set the property on because it should probably be typed as
Input[str | None]
a

adamant-author-732

02/08/2023, 11:12 AM
It’s
azure-native > network.ARecordArgs
here: https://github.com/pulumi/pulumi-azure-native/blob/master/sdk/python/pulumi_azure_native/network/_inputs.py#L298. The type hint is
ipv4_address: Optional[pulumi.Input[str]]
which gets interpreted as
Input[str] | None
.
e

echoing-dinner-19531

02/08/2023, 12:49 PM
Yup thanks that's a bug in the code generator, I thought we already had a bug report for that but I can't find it now. I'll double check again and get an issue raised for this, should be a very quick fix.