https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

06/06/2019, 11:00 PM
In the
create
method of my
pulumi.dynamic.ResourceProvider
, I have some Pulumi `Output`s that I want to wait for before marking my resource as created. How would I wait for the Outputs to materialize?
Can you
await
`pulumi.Input`s?
Ultimately, I think this is my issue:
Copy code
Type 'Promise<Output<{ id: string; outs: string; }>>' is not assignable to type 'Promise<CreateResult>'.
I somehow need to work with Pulumi outputs/inputs inside of the
create
method.
w

white-balloon-205

06/06/2019, 11:23 PM
You can use
.get
on your Outputs inside dynamic providers, since they will be run in a separate process. If you have not yet seen this - it’s worth a read - it doesn’t exactly answer this question, but does provide some background to understand why this is true: https://pulumi.io/reference/programming-model/#dynamicproviders
f

full-dress-10026

06/06/2019, 11:24 PM
Yep, that has been quite helpful! This last bit of navigating input/outputs has proven the hardest.
I receive this message when trying to use `get`:
Copy code
error: Plan apply failed: Cannot call '.get' during update or preview.
    To manipulate the value of this Output, use '.apply' instead.
Example of what I'm trying to do:
Copy code
async create(args: DatomicIonsArgs) {
    const configUri = pulumi.output(args.configUri).get();

    const cliResult = await deployIons({
        projectDirectory: args.projectDirectory,
        configUri: configUri
    }, this);

    console.log(cliResult);

    if (cliResult) {
        return {id: "", outs: ""};
    } else {
        throw new Error("Ion deployment failed.");
    }
}
Somehow the example here https://github.com/pulumi/pulumi/blob/master/examples/dynamic-provider/simple/index.ts uses Inputs in the args. I don't see how that can work.
Somehow it is pulling
inputs.left
and
inputs.right
off of
inputs
in the create method. I believe those are actually going to be
Input<number>
not
number
. Unless Pulumi is unwrapping things behind the scenes...
The example isn't very helpful because lots of things are typed with
any
.
Does Pulumi pass the actual, unwrapped (i.e. non-Output) values of the
inputs
to the provider methods?
w

white-balloon-205

06/07/2019, 12:45 AM
Pulumi will indeed have unwrapped any inputs before passing them into the
create
method, so you should not in general have to deal with outputs here. In particular
arts.configUri
will be a plain JavaScript object already.
f

full-dress-10026

06/07/2019, 12:47 AM
I see, makes sense! I think that fixes it.