https://pulumi.com logo
#getting-started
Title
# getting-started
s

square-night-79134

06/22/2023, 12:52 PM
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

salmon-account-74572

06/22/2023, 3:45 PM
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

square-night-79134

06/22/2023, 3:45 PM
Hi Scott, I looked at the pulumi import but it’s all taking about aws
s

salmon-account-74572

06/22/2023, 3:50 PM
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

rhythmic-france-96553

06/22/2023, 10:39 PM
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

salmon-account-74572

06/22/2023, 10:40 PM
@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

rhythmic-france-96553

06/22/2023, 10:41 PM
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

salmon-account-74572

06/22/2023, 10:46 PM
Hmm…that should be possible, unless there’s something of which I’m not aware.
r

rhythmic-france-96553

06/22/2023, 11:27 PM
@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

salmon-account-74572

06/23/2023, 2:23 PM
Interesting! Have you filed an issue on that behavior? (If you haven’t and you can, that would be very helpful.)
s

square-night-79134

06/23/2023, 6:17 PM
@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

rhythmic-france-96553

06/25/2023, 10:12 PM
@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

square-night-79134

06/26/2023, 7:00 AM
@rhythmic-france-96553 Great! When you run pulumi import, Did VPC was imported successfully with NAT and subnet?
s

salmon-account-74572

06/26/2023, 2:55 PM
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

square-night-79134

06/26/2023, 3:01 PM
Ah! Ok @salmon-account-74572 Any guidance / tutorial links for that particularly fir GCP?
s

salmon-account-74572

06/26/2023, 3:04 PM
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)