File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -134,3 +134,18 @@ resource "google_container_node_pool" "pools" {
134
134
135
135
depends_on = [" google_container_cluster.primary" ]
136
136
}
137
+
138
+ resource "null_resource" "wait_for_regional_cluster" {
139
+ count = " ${ var . regional ? 1 : 0 } "
140
+
141
+ provisioner "local-exec" {
142
+ command = " ${ path . module } /scripts/wait-for-cluster.sh ${ var . project_id } ${ var . name } "
143
+ }
144
+
145
+ provisioner "local-exec" {
146
+ when = " destroy"
147
+ command = " ${ path . module } /scripts/wait-for-cluster.sh ${ var . project_id } ${ var . name } "
148
+ }
149
+
150
+ depends_on = [" google_container_cluster.primary" , " google_container_node_pool.pools" ]
151
+ }
Original file line number Diff line number Diff line change @@ -134,3 +134,18 @@ resource "google_container_node_pool" "zonal_pools" {
134
134
135
135
depends_on = [" google_container_cluster.zonal_primary" ]
136
136
}
137
+
138
+ resource "null_resource" "wait_for_zonal_cluster" {
139
+ count = " ${ var . regional ? 0 : 1 } "
140
+
141
+ provisioner "local-exec" {
142
+ command = " ${ path . module } /scripts/wait-for-cluster.sh ${ var . project_id } ${ var . name } "
143
+ }
144
+
145
+ provisioner "local-exec" {
146
+ when = " destroy"
147
+ command = " ${ path . module } /scripts/wait-for-cluster.sh ${ var . project_id } ${ var . name } "
148
+ }
149
+
150
+ depends_on = [" google_container_cluster.zonal_primary" , " google_container_node_pool.zonal_pools" ]
151
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Copyright 2018 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ set -e
17
+
18
+ PROJECT=$1
19
+ CLUSTER_NAME=$2
20
+ gcloud_command=" gcloud container clusters list --project=$PROJECT --format=json"
21
+ jq_query=" .[] | select(.name==\" $CLUSTER_NAME \" ) | .status"
22
+
23
+ echo " Waiting for cluster $2 in project $1 to reconcile..."
24
+
25
+ current_status=$( $gcloud_command | jq -r " $jq_query " )
26
+
27
+ while [[ " ${current_status} " == " RECONCILING" ]]; do
28
+ printf " ."
29
+ sleep 5
30
+ current_status=$( $gcloud_command | jq -r " $jq_query " )
31
+ done
32
+
33
+ echo " Cluster is ready!"
You can’t perform that action at this time.
0 commit comments