Hello Everyone, I am new to this community and new...
# getting-started
s
Hello Everyone, I am new to this community and new to pulumi as well. I am looking for a tutorial or guides to import the existing GCP private auto pilot kubernetes. Is there any guide or to do list available for it?
s
One place to start would be here: https://www.pulumi.com/docs/using-pulumi/adopting-pulumi/import/ The next place would be looking at the API docs for the specific resources you want to import; they’ll provide more details. For example, GKE is here: https://www.pulumi.com/registry/packages/gcp/api-docs/container/cluster/ There’s an “Import” section at the bottom that provides some example usage of
pulumi import
with that specific resource. Hope this helps!
s
Hi Scott, I looked at the pulumi import but it’s all taking about aws
s
The docs for
pulumi import
use AWS resources as examples, true. However, the concepts behind how to use the
pulumi import
command are there, and when you review the second link I posted you can see specific examples of how to use
pulumi import
with GCP resources, like GKE (look in the “Import” section at the bottom of the second link).
r
Note that when you import an autopilot cluster, the definition will contain more details than pulumi will actually allow when you run
pulumi preview
. I’ve managed to import one by running the import command in the GKE cluster docs and then cutting things out of the definition until
pulumi preview
no longer complained. Bit of a messy process
s
@rhythmic-france-96553 Good point about Autopilot; if that’s enabled, a lot of other settings can’t be specified and will produce an error.
r
And another note on autopilot clusters - I don’t think it’s currently possible to create them using pulumi (not enirely sure but I didn’t succeed) . Can import them and then manage them, though.
s
Hmm…that should be possible, unless there’s something of which I’m not aware.
r
@salmon-account-74572 Sorry, missed the response - it’s been a few days but from memory, creating the bare minimum cluster definition and adding the autopilot directive to it complains that it requires a node pool max setting, but setting it complains that you can’t change that setting on autopilot clusters.
s
Interesting! Have you filed an issue on that behavior? (If you haven’t and you can, that would be very helpful.)
s
@rhythmic-france-96553 so is there a way that I can achieve it? Probably using pulumi import and then use these variables to create a new cluster?
r
@square-night-79134 That’s what I did - created an autopilot cluster, imported it and then removed a lot of stuff from the resultant output until pulumi preview worked, as per my previous comment.
s
@rhythmic-france-96553 Great! When you run pulumi import, Did VPC was imported successfully with NAT and subnet?
s
I’ll defer to @rhythmic-france-96553 for his experience, but I suspect that importing a cluster did not also import associated resources like networks and subnets. You’ll most likely need to import those separately.
s
Ah! Ok @salmon-account-74572 Any guidance / tutorial links for that particularly fir GCP?
s
You can use the same
pulumi import
command to import any supported resource, including GCP Networks and GCP Subnets. At the bottom of each page for a supported resource, you’ll find an example
pulumi import
command. (By “page for a supported resource,” I’m referring to the API documentation pages like this one)