pulumi / pulumi

Pulumi - Infrastructure as Code in any programming language 🚀
https://www.pulumi.com
Apache License 2.0
21.8k stars 1.12k forks source link

Importing Existing Azure VNet resource fails review with EnableVmProtection field error #9589

Open MarkGee-imdex opened 2 years ago

MarkGee-imdex commented 2 years ago

What happened?

I've setup a dotnet pulumi project using Azure Native to define resources. The Pulumi CLI has been working fine up until recently when I tried to import an existing Azure VNet resource using Pulumi.AzureNative.Network.V20201101.VirtualNetwork.

Sample Csharp code is here: ImportExistingVNet_csharp_code.txt

The Pulumi review is failing say that there was an issue with the EnabledVmProtection field but this field has been superseded by the EnableDdosProtection field which is present in the Azure template for that resource. No matter how I set either of these fields, the same Pulumi CLI review issue appears. The CLI output is here: Pulumi CLI output - Vnet import issue

The Debug output can be found here: out.txt

Can you please help. Thanks. .

Steps to reproduce

  1. Build csharp project
  2. In a command prompt in the project's root directory: 2.1. Pulumi up

Expected Behavior

The Pulumi review should complete without any errors and the update should complete successfully

Actual Behavior

The Pulumi review fails with the following:

azure-native:network/v20201101:VirtualNetwork VirtualNetworkResource import [diff: +enableVmProtection]; 1 warning

Versions used

out.txt Pulumi about output:

Pulumi about

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).

mikhailshilkov commented 2 years ago

The ImportId is very strict: it requires you to specify all the arguments exactly as the Azure API returns them. As an alternative, please consider the pulumi import command which will both generate code for your existing resource and import the resource into Pulumi state automatically.

You can see the command syntax here: https://www.pulumi.com/registry/packages/azure-native/api-docs/network/virtualnetwork/#import

MarkGee-imdex commented 2 years ago

I've added Pulumi about output to this bug report as requested.

MarkGee-imdex commented 2 years ago

Done

From: Mikhail Shilkov @.> Sent: Saturday, 14 May 2022 11:16 AM To: pulumi/pulumi @.> Cc: Mark Gee @.>; Mention @.> Subject: Re: [pulumi/pulumi] Importing Existing Azure VNet resource fails review with EnableVmProtection field error (Issue #9589)

This message is from an external sender. Please be cautious, particularly with links and attachments.

@MarkGee-imdexhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMarkGee-imdex&data=05%7C01%7Cmark.gee%40imdexlimited.com%7Cca233be7a30c42d2d95508da35581df8%7C4779caacad3f47de9ed04a6d1210ac28%7C0%7C0%7C637880949824424983%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BMFa7TA6VUEy9dhEqkSQuI9fmGKd9bXcWKjPBO6fn6Q%3D&reserved=0 thank you for reaching out and sorry for the trouble. Could you please run pulumi about and add its output to the issue? Thank you!

- Reply to this email directly, view it on GitHubhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpulumi%2Fpulumi%2Fissues%2F9589%23issuecomment-1126624641&data=05%7C01%7Cmark.gee%40imdexlimited.com%7Cca233be7a30c42d2d95508da35581df8%7C4779caacad3f47de9ed04a6d1210ac28%7C0%7C0%7C637880949824424983%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nvyLDPZ76E1mywoRdsuakjdM%2BYDDOvTaM%2FC%2FpkwRm%2FY%3D&reserved=0, or unsubscribehttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAV46EVZ6LXA4KX3PNWDJW73VJ4LIDANCNFSM5V2OOCJQ&data=05%7C01%7Cmark.gee%40imdexlimited.com%7Cca233be7a30c42d2d95508da35581df8%7C4779caacad3f47de9ed04a6d1210ac28%7C0%7C0%7C637880949824424983%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=SHCZ7dTCS%2FmLWa%2B0wk8Ar6wZW1qz6cuCDlzlr9kdyWQ%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>