diff --git a/gcp/table_gcp_kubernetes_node_pool.go b/gcp/table_gcp_kubernetes_node_pool.go index af53ff09..551c2b23 100644 --- a/gcp/table_gcp_kubernetes_node_pool.go +++ b/gcp/table_gcp_kubernetes_node_pool.go @@ -148,6 +148,13 @@ func listKubernetesNodePools(ctx context.Context, d *plugin.QueryData, h *plugin // Get the details of Cluster cluster := h.Item.(*container.Cluster) + // This operation is not allowed if the cluster has Autopilot Enabled. + // We are getting the error Error: gcp: googleapi: Error 400: Autopilot node pools cannot be accessed or modified. + + if cluster.Autopilot.Enabled { + return nil, nil + } + // Create Service Connection service, err := ContainerService(ctx, d) if err != nil { @@ -205,6 +212,11 @@ func getKubernetesNodePool(ctx context.Context, d *plugin.QueryData, h *plugin.H resp, err := service.Projects.Locations.Clusters.NodePools.Get(parent).Do() if err != nil { + // This operation is not allowed if the cluster has Autopilot Enabled. + // We are getting the error Error: gcp: googleapi: Error 400: Autopilot node pools cannot be accessed or modified. + if strings.Contains(err.Error(), "Autopilot node pools cannot be accessed or modified") { + return nil, nil + } return nil, err }