Open automagic opened 1 week ago
Hi @automagic, sorry you're seeing an incomplete import. The import is decided by what the provider reads from Azure. To further investigate this, would you be able to capture verbose logs? They won't contain secrets but you might want to sanitize your subscription id.
@thomas11 For azure sql virtual machine there are two rest api's for which you are getting the properties: https://learn.microsoft.com/en-us/rest/api/sqlvm/sql-virtual-machines/get?view=rest-sqlvm-2023-10-01&tabs=HTTP. I didn't look at the pulumi call to see which api is using but for sure is using the one which returns some basic props. In order to fix it, you should call the one with optional parameter.
That makes sense. The expand
parameter is also used in the request URL @automagic posted above. We haven't encountered such a case yet and will look into how to support it best in a maintainable way.
What happened?
When importing a SqlVirutalMachine with Pulumi, the import code generation appears to be missing many properties of the existing instance.
Example
Currently when you import a sql virtual machine you will get the following code generated:
However, if we call the rest api:
curl --location --request GET 'https://management.azure.com/subscriptions/1111-1111-1111-1111/resourceGroups/RG-TEST/providers/Microsoft.SqlVirtualMachine/SqlVirtualMachines/SQLTEST?$expand=*&api-version=2023-10-01' \ --header 'Authorization: Bearer YourAzureToken'
We get the following result:
We see there are many missing properties, which are available on the Azure RM API and also documented in Pulumi:
Output of
pulumi about
latest
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).