https://pulumi.com logo
Title
c

cuddly-xylophone-65881

12/31/2020, 9:27 AM
Hi all, I'm running into an issue importing existing resources from azure. For example, if I try to import a VirtualNetworkGateway, I'm getting the following error:
Diagnostics:
  azure:network:VirtualNetworkGateway (cgw-snm-net-blue):
    error: azure:network/virtualNetworkGateway:VirtualNetworkGateway resource 'cgw-snm-net-blue' has a problem: Missing required property 'type'
    error: azure:network/virtualNetworkGateway:VirtualNetworkGateway resource 'cgw-snm-net-blue' has a problem: Missing required property 'sku'
    error: azure:network/virtualNetworkGateway:VirtualNetworkGateway resource 'cgw-snm-net-blue' has a problem: Missing required property 'ipConfigurations'
    error: Preview failed: one or more inputs failed to validate

  pulumi:pulumi:Stack (autopilot-azure-autopilot-azure):
    error: preview failed
Interestingly enough though, if I look at the debug output, it does have a type, sku and ip configurations. What would be the recommended way moving forward? Just trying to import the resource manually by patching the stack?
t

tall-librarian-49374

12/31/2020, 9:31 AM
Could you show me your code for
VirtualNetworkGateway
?
c

cuddly-xylophone-65881

12/31/2020, 9:31 AM
do you mean, the code that imports the resource? because I haven't written the code for the resource yet. It's been manually clicked together by somebody and I need to absorb it into my code
Note, it's not just with VirtualNetworkGateway's that i'm running into this problem, also with LocalNetworkGateway
t

tall-librarian-49374

12/31/2020, 9:33 AM
How are you running the import?
c

cuddly-xylophone-65881

12/31/2020, 9:35 AM
I've tried the pulumi command line, so
pulumi import azure:network/virtualNetworkGateway:VirtualNetworkGateway cgw-snm-net-blue /subscri....
or via a json file
t

tall-librarian-49374

12/31/2020, 9:35 AM
And then copying the resulting code to your program?
c

cuddly-xylophone-65881

12/31/2020, 9:36 AM
yes, that's the process that i'm following right now, just to get the skeleton
then I can do some cleanups..
t

tall-librarian-49374

12/31/2020, 9:36 AM
So, could you show me that code that you pasted?
c

cuddly-xylophone-65881

12/31/2020, 9:36 AM
the import isn't generating any code for this resource, as it's failing
t

tall-librarian-49374

12/31/2020, 9:37 AM
That’s the problem then
c

cuddly-xylophone-65881

12/31/2020, 9:37 AM
thing is, if I write the code without importing, i worry it will create a duplicate resource
t

tall-librarian-49374

12/31/2020, 9:38 AM
You could write your code manually but add
ImportId
option to the resource
c

cuddly-xylophone-65881

12/31/2020, 9:38 AM
I'll give that a try
c

cuddly-xylophone-65881

12/31/2020, 9:38 AM
I was just reading that bit as well
t

tall-librarian-49374

12/31/2020, 9:39 AM
But please open an issue for the failing import command: that sounds like a bug somewhere
c

cuddly-xylophone-65881

12/31/2020, 9:40 AM
cool, I'll do that! Thanks. I'll also add the resolution if it works by manually writing the code
So writing the code myself works. I'll file a bug for the code gen issue
👍 1