https://pulumi.com logo
r

rich-whale-93740

09/06/2023, 6:55 PM
What would be a good practice on "exporting" ARNs from created resource, especially for multiple projects within single repo? For example, a few roles are created in the
iam
project. They are later used by
infra
project.
b

billowy-army-68599

09/06/2023, 6:57 PM
then use a stack reference in the infra project: https://www.pulumi.com/learn/building-with-pulumi/stack-references/
s

salmon-account-74572

09/06/2023, 7:57 PM
r

rich-whale-93740

09/06/2023, 8:12 PM
👍 thanks both!
May I ask for advice on exporting a dict in Python?
Copy code
iac_admin_role_arns = {}
    for account in ACCOUNTS:
        iac_admin_role_arns[str(account)] = <role arn Output>
    
    pulumi.export("iac-admin-role-arns", iac_admin_role_arns)
This throws:
Copy code
k: await serialize_property(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/dennispan/code/iac/iam/venv/lib/python3.11/site-packages/pulumi/runtime/rpc.py", line 562, in serialize_property
        raise ValueError(f"unexpected input of type {type(value).__name__}")
    ValueError: unexpected input of type dict_values
b

billowy-army-68599

09/06/2023, 9:12 PM
this looks like you’re trying to add an output to a dict of string, rather than an export problem
r

rich-whale-93740

09/06/2023, 9:56 PM
Ah indeed. It was actually caused by
.values()
on the dict and passed that to where a
list
is expected. Thanks for taking a look!