This module discovers a Google Kubernetes Engine (GKE) cluster that already exists in Google Cloud and outputs cluster attributes that uniquely identify it for use by other modules. The module outputs are aligned with the gke-cluster module so that it can be used as a drop-in substitute when a GKE cluster already exists.
The below sample blueprint discovers the existing GKE cluster named "my-gke-cluster" in "us-central1" region. With the use
keyword, the
gke-node-pool module accepts the cluser_id
input variable that uniquely identifies the existing GKE cluster in which the
GKE node pool will be created.
- id: existing-gke-cluster
source: community/modules/scheduler/pre-existing-gke-cluster
settings:
project_id: $(vars.project_id)
cluster_name: my-gke-cluster
region: us-central1
- id: compute_pool
source: community/modules/compute/gke-node-pool
use: [existing-gke-cluster]
NOTE: The
project_id
andregion
settings would be inferred from the deployment variables of the same name, but they are included here for clarity.
Copyright 2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Name | Version |
---|---|
terraform | >= 1.0.0 |
> 5.0 |
Name | Version |
---|---|
> 5.0 |
No modules.
Name | Type |
---|---|
google_container_cluster.existing_gke_cluster | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_name | Name of the existing cluster | string |
n/a | yes |
project_id | Project that hosts the existing cluster | string |
n/a | yes |
region | Region in which to search for the cluster | string |
n/a | yes |
Name | Description |
---|---|
cluster_id | An identifier for the gke cluster with format projects/{{project_id}}/locations/{{region}}/clusters/{{name}}. |
gke_cluster_exists | A static flag that signals to downstream modules that a cluster exists. |