https://pulumi.com logo
g

glamorous-printer-66548

12/03/2019, 6:48 PM
Hi, I'm trying to adopt a bunch of existing resources into pulumi. To do so I'm using this syntax:
Copy code
new datadog.Dashboard('foo',
  { description: 'foo', layoutType: 'ordered', widgets: [], title: 'foo' },
  {
    import: '3abc-qix-gn5',
  }
);`
Note that in this example the widgets part is under-specified - the to-be-imported resource has already many items under
widgets
. Therefore when I do a preview, I get
inputs to import do not match the existing resource; importing this resource will fail
which is kinda fine. When I do the preview with diff I can actually see what parts in my config are missing. Ideally I'd like to copy the widgets section from the diff and simply copy & paste it into my pulumi (typescript) code, so that I don't have to create all the inputs code from scratch. However while the diff looks javascript-ish, it's missing commas and has all the
-
and
[arrayindex]
characters. Now my question is: Is there a way I can get a more javascript-ish diff without all those extra characters so that I can simply use the diff as my starting point for the config? Or is there any other way to semi-manually generate pulumi code for existing resources to ease adoption? Note I already tried
pulumi preview --diff --json
but unfortunately the detailed diff is missing when I do so (unlike when running
pulumi preview --diff
which shows the full diff but with all those extraneous diff characters.)
w

white-balloon-205

12/03/2019, 6:55 PM
Is there a way I can get a more javascript-ish diff without all those extra characters so that I can simply use the diff as my starting point for the config?
There is not today - but it's something we've talked about for this use case.
I already tried
pulumi preview --diff --json
but unfortunately the detailed diff is missing when I do so
This is likely going to be the best path to exposing this - and it sounds like almost a bug that this doesn't include the diff details in the JSON output. Could you open an issue to track this?
g

glamorous-printer-66548

12/03/2019, 8:45 PM
sure will do