https://pulumi.com logo
Title
b

boundless-airport-99052

03/09/2021, 2:51 PM
Hello team, I wrote a Dynamic Providers and I wonder if the resources created this way can be refreshed? I can’t figure it out.
I wonder if this is possible? I can’t find anything about it. @tall-librarian-49374 do you know if dynamic provider / resource support refresh?
t

tall-librarian-49374

03/09/2021, 3:25 PM
I think yes, via
read
. Are you asking because it doesn’t work?
b

boundless-airport-99052

03/09/2021, 3:36 PM
yes. I haven’t implemented the
read
method, I just add a
console.log
, but it was never called, I will try to implement it
Here is my implementation
async read(id: pulumi.ID, props?: any): Promise<pulumi.dynamic.ReadResult> {            console.log(`pulumi.dynamic.ResourceProvider: call --read-- on ${id}`)
      <http://pulumi.log.info|pulumi.log.info>(`pulumi.dynamic.ResourceProvider: call --read-- on ${id}`)
return {id: ''}
 }
Then I do a
pulumi up
to serialize this to the state. Then I do a
pulumi refresh
, but the resource is not refreshed and I can’t see any logs
The pulumi refresh output are
~  pulumi-nodejs:dynamic:Resource mgsub-sub-it-foundations-test-a-sandbox refreshing 
    pulumi-nodejs:dynamic:Resource mgsub-sub-it-foundations-test-a-sandbox
t

tall-librarian-49374

03/09/2021, 4:13 PM
That’s odd. To be sure - did you create your resource after you added the read implementation?
b

boundless-airport-99052

03/09/2021, 4:22 PM
no I haven’t recreated it
I will try
it works 👍
but it’s still obscur for me
and this is not documented
do you have more details?
t

tall-librarian-49374

03/09/2021, 5:02 PM
Your code is saved in resource state. You need to update the resource to update the code, including read and delete
b

boundless-airport-99052

03/09/2021, 6:13 PM
I’ve done this before, … unless I miss something. That’s said, thank for your help 🙂
I finally succeed to make refresh working. I updated the example in https://github.com/pulumi/pulumi-azure-native/issues/553 I opened an issue to explain my pain 🙂 https://github.com/pulumi/pulumi/issues/6490
👍 2