This message was deleted.
# general
s
This message was deleted.
g
The console hides and converts a lot of quirks of the API. The resources on Pulumi are almost a direct mapping of the API, with some rare exceptions, so I would get the raw API resource and write it on Pulumi
f
Manually?
g
Yep, importing is a very manual job most of the times.
b
Th pulumi import command should scaffold this for you and give you the output
I posted the cli command for your usecase earlier
f
The undocumented
import
command?
b
the CLI function that is still in development, yes
👍 1
f
You did. I appreciate that. I lost it in the history and tried to do it the documented way.
b
pulumi import gcpcompute/instanceInstance <resource name> <import id>
that command
f
It's still in development but it's available for use?
b
it is - it was dark launched
f
Haha, thanks Paul. I'll
alias
it.
b
so we can test it internally
that gcp:compute segment is a specific type that the docs will surface
f
Okay, I'll remove the imported resource and try this.
b
if you pulumi destroy now it will delete your infra
f
Not a huge deal since right now nothing is running, but I'd like to avoid that.
b
personally, I would try it in another stack as a test
f
Oh, that's smart.
@broad-dog-22463 The import failed.
Copy code
fuzzybear3965/webbie/new (pulumi:pulumi:Stack)
error: preview failed
 
webbie (gcp:compute:Instance)
error: gcp:compute/instance:Instance resource 'webbie' has a problem: Computed attribute cannot be set
error: gcp:compute/instance:Instance resource 'webbie' has a problem: ConflictsWith
error: gcp:compute/instance:Instance resource 'webbie' has a problem: ConflictsWith
error: gcp:compute/instance:Instance resource 'webbie' has a problem: Computed attribute cannot be set
error: Preview failed: one or more inputs failed to validate
ConflictsWith
doesn't give me a lot of information, so I'm stuck here.
b
so there's still
I'll create the exact same resource and try and import it to see what the issue is here
something is acting weird for sure
f
I'm not sure what the value of
resource name
should be.
I set it to the
name
value of my VM.
I executed
..\pulumi-v2.13.2-windows-x64\Pulumi\bin\pulumi.exe import gcp:compute/instance:Instance webbie 1214816920423977412
. The last number is the
instance ID
value in GCP for that VM instance.
@broad-dog-22463 Another weird thing is that I was instructed in the output to "copy the following code into my Pulumi application". But, no "following code" was present.
Copy code
PS C:\Users\johnr\Downloads\webserver-new> ..\pulumi-v2.13.2-windows-x64\Pulumi\bin\pulumi.exe import gcp:compute/instance:Instance webbie 1214816920423977412
Previewing import (new)

View Live: <https://app.pulumi.com/fuzzybear3965/webbie/new/previews/7c0882db-b146-4ced-9512-a188d8f3d345>

     Type                     Name        Plan       Info
 +   pulumi:pulumi:Stack      webbie-new  create     1 error
 =   └─ gcp:compute:Instance  webbie      import     5 errors

Diagnostics:
  pulumi:pulumi:Stack (webbie-new):
    error: preview failed

  gcp:compute:Instance (webbie):
    error: gcp:compute/instance:Instance resource 'webbie' has a problem: Computed attribute cannot be set
    error: gcp:compute/instance:Instance resource 'webbie' has a problem: ConflictsWith
    error: gcp:compute/instance:Instance resource 'webbie' has a problem: ConflictsWith
    error: gcp:compute/instance:Instance resource 'webbie' has a problem: Computed attribute cannot be set
    error: Preview failed: one or more inputs failed to validate


Please copy the following code into your Pulumi application. Not doing so
will cause Pulumi to report that an update will happen on the next update command.

Please note, that the imported resources are marked as protected. To destroy them
you will need to remove the `protect` option and run `pulumi update` *before*
the destroy will take effect.
b
that command you ran is correct but that's very strange behaviour as the code imported outside of the CLI
I can test this
and now you can see why this is a dark launch - so we can continue stress testing this
1
and UX test it
f
Happy to help with that.
Oh, @broad-dog-22463 Is the "code that's output at the end" supposed to be the exact code that I put into my program?
That's what you meant earlier by "import should scaffold everything for you"?
b
yes
f
Ahhh, but I see no output because s*** happens.
Haha, I see. No problem.
Let me know if you need me to run any tests.
b
thanks!
👍 1