sparse-intern-71089
02/07/2024, 5:59 PMancient-policeman-24615
02/14/2024, 2:18 AMid is an arbitrary string, so you can communicate anything you want in it. If you wanted to, you have have import take a JSON object representing inputs, and then model the import as a create (computing outputs).
For example: Imagine a resource Sum with inputs op1 and op2 and output result. You could allow this:
pulumi import pkg:module:resource three '{ "op1": 1, "op2": 2 }'
Read would then return { ID: three, state: { op1: 1, op2: 2, result: 3 } }.
P.S. Read is used to model both import and refresh. An import will have no prior state, while a refresh will. You need to be careful that when Read is called for a refresh, it doesn’t change anything.