great-sunset-355
10/18/2021, 12:48 PMruntime.invoke
raises Exception
which is not a good practice in python and one should use custom exceptions, so at least raising PulumiError
or something would be great.
https://github.com/pulumi/pulumi/blob/master/sdk/python/lib/pulumi/runtime/invoke.py#L121
@red-match-15116 Is there any chance that there is an existing issue about this? (I could not find any)
I bumped into this trying to get an existing RDS instance when I found out that the classic
AWS provider differentiates between 2 types and I'm only interested in arguments that they have in common.
try:
db = rds.get_cluster(
cluster_identifier=db_params.apply(lambda x: x["db"]["identifier"]),
opts=pulumi.InvokeOptions(provider=ec1_provider),
)
except Exception as exc:
print(type(exc))
db = rds.get_instance(
db_instance_identifier=db_params.apply(lambda x: x["db"]["identifier"]),
opts=pulumi.InvokeOptions(provider=ec1_provider),
)
AWS SDK in this case raises DBClusterNotFoundFault
but I guess that pulumi.runtime.invoke
is not smart enough to raise this exception.red-match-15116
10/18/2021, 4:10 PM