laurmurclar/datadog-to-terraform

Add an "Export to Terraform" button into the Datadog UI

Opened this issue · 2 comments

Chrome Extensions can modify the DOM - it would be awesome to have a button in the Export Monitor panel in Datadog. The button could take care of pulling out the monitor json & doing code generation all in one step.

image

Was trying to build this during my spare time, (note: don't have much FE experience), but hit a wall:
Unexpected token 'export'
Cannot use import statement outside a module

Basically was trying to split intro folders and reuse same code, but I get those errors when loading the js files. If you know how to get around those issues, please say so.

Hey @flavio-cadete-cko ! Cheers.

It's hard to know what exactly has gone wrong without seeing the code but it looks like you've got a syntax error or you're importing or exporting something incorrectly. This article gives some short and sweet examples of what those should look like.

BTW, I actually looked into this before but never left an update here. I think this will be a bit more complicated than I expected, since it involves a modal with elements that aren't in the DOM when the page is opened. We'd have to watch for the event which opens the modal and then try insert the button. Also, you can view the JSON for existing monitors and also when creating new ones, so we'd have to cover both cases. Another thing - it can't be done for dashboards/timeboards, only monitors, as exporting dashboards puts the JSON directly into your clipboard rather than adding it to the DOM.

I think it would be a really nice feature but I'm not sure it's worth it, it will be brittle to maintain since Datadog can obviously change their DOM and break it at any time 😞