Skip to content

Commit

Permalink
fix: set project number for ASM install (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb committed Sep 30, 2020
1 parent 6f0e749 commit c5d1e4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion modules/asm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* limitations under the License.
*/

data "google_project" "asm_project" {
project_id = var.project_id
}


module "asm_install" {
source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper"
version = "~> 2.0.2"
Expand All @@ -29,6 +34,6 @@ module "asm_install" {
service_account_key_file = var.service_account_key_file


kubectl_create_command = "${path.module}/scripts/install_asm.sh ${var.project_id} ${var.cluster_name} ${var.location} ${var.asm_dir} ${var.asm_version}"
kubectl_create_command = "${path.module}/scripts/install_asm.sh ${var.project_id} ${var.cluster_name} ${var.location} ${var.asm_dir} ${var.asm_version} ${data.google_project.asm_project.number}"
kubectl_destroy_command = "kubectl delete ns istio-system"
}
4 changes: 3 additions & 1 deletion modules/asm/scripts/install_asm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

set -e

if [ "$#" -lt 5 ]; then
if [ "$#" -lt 6 ]; then
>&2 echo "Not all expected arguments set."
exit 1
fi
Expand All @@ -25,6 +25,7 @@ CLUSTER_NAME=$2
CLUSTER_LOCATION=$3
ASM_RESOURCES=$4
ASM_VERSION=$5
PROJECT_NUM=$6
BASE_DIR="asm-base-dir"
# check for needed binaries
# kustomize is a requirement for installing ASM and is not available via gcloud. Safely exit if not available.
Expand Down Expand Up @@ -53,6 +54,7 @@ kpt cfg set asm-patch/ base-dir ../${BASE_DIR}
kpt cfg set asm-patch/ gcloud.core.project "${PROJECT_ID}"
kpt cfg set asm-patch/ gcloud.container.cluster "${CLUSTER_NAME}"
kpt cfg set asm-patch/ gcloud.compute.location "${CLUSTER_LOCATION}"
kpt cfg set asm-patch/ gcloud.project.environProjectNumber "${PROJECT_NUM}"
kpt cfg list-setters asm-patch/
pushd ${BASE_DIR}
kustomize create --autodetect --namespace "${PROJECT_ID}"
Expand Down

0 comments on commit c5d1e4d

Please sign in to comment.