pulumi / pulumi-cloud-import

Import infrastructure managed outside of Pulumi IaC into Pulumi Insights
Apache License 2.0
9 stars 2 forks source link

Add Azure Support #1

Closed EvanBoyle closed 1 year ago

EvanBoyle commented 1 year ago

Adds support for importing Azure resources via azure-native. Roughly works by:

  1. Calling the List Resources ARM API filtered by location and subscription
  2. Attempting to convert types into a pulumi token
  3. doing a lookup against the azure-native schema to make sure the translated type exists
  4. sending the import spect to a channel and performing a GetResource operation on the other end

I was able to get this to succeed on all but one resource in the pulumi subscription except for one resource that was returned by list but 404d when I tried to read it. I assume this is because my user is lacking some permissions on that specific resource.

The buggiest part of this is (2) as azure returns something like Microsoft.Network/dnszones and our resource schema assumes that this value is singular and that acronyms are capitalized. I use a library for plurality that seems to work pretty well, but haven't tried to tackle acronyms.

I saw this in the AWS importer as well, but it seems like storing a mapping from the cloud provider literal type to whatever we translate it to, would be super useful for building this category of tooling.