pulumi / pulumi-converter-terraform

Apache License 2.0
9 stars 3 forks source link

Consider supporting `--convert-examples` via plugin-run #180

Open guineveresaenger opened 2 months ago

guineveresaenger commented 2 months ago

Hello!

Issue details

Currently, --convert-examples is a bit of a hack to enable bulk conversion of bridged provider examples. I was told this could be more fully supported via plugin-run

Core details

plugin run is a new currently experimental command that allows the engine to directly invoke a plugin binary to run it as a standalone exe. --convert-examples is an arg to the terraform converter that makes it ignore the input from the engine when calling ConvertProject and instead does a bulk conversion of the file specified on the argument. We added it to the converter this way because conversion depends on the mapper service from the engine to do the conversion, and currently the only way to get hold of the mapper service is in ConvertProject.

We could expose engine services, like the mapper (or schema loading, or other things we add) to standalone plugin runs somehow. If we did that we could change the converter to do bulk conversion just via something like pulumi plugin run --kind converter terraform -- --convert-examples=file.json. UX call this isn't much different to the current pulumi convert terraform -- --convert-examples=file.json but it will make a lot more sense code wise when looking at how the converter code works.

Affected area/feature

--convert-examples flag