From 6a75a3d2be480c67c9d21fe019d54b2ffbcca338 Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Sat, 25 Apr 2020 07:34:01 +0200 Subject: [PATCH] add peering config via GKE module to hub and spoke peering README --- .../hub-and-spoke-peering/README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/infrastructure/hub-and-spoke-peering/README.md b/infrastructure/hub-and-spoke-peering/README.md index 82ed9a489..836fb5648 100644 --- a/infrastructure/hub-and-spoke-peering/README.md +++ b/infrastructure/hub-and-spoke-peering/README.md @@ -41,7 +41,24 @@ gcloud container clusters get-credentials cluster-1 --zone europe-west1-b kubectl get all ``` -The next step is to edit the peering towards the GKE master tenant VPC, and enable export routes. The peering has a name like `gke-xxxxxxxxxxxxxxxxxxxx-xxxx-xxxx-peer`, you can edit it in the Cloud Console from the *VPC network peering* page or using `gcloud`: +The next step is to edit the peering towards the GKE master tenant VPC, and enable export routes. You can do it directly in Terraform with the GKE module `peering_config' variable, via gcloud, or on the cloud ccnsole. We're leaving it as an option, since one of the goals of this example is to allow testing both working and non-working configurations. + +### Export routes via Terraform + +Change the GKE cluster module and add a new variable after `private_cluster_config`: + +```hcl + peering_config = { + export_routes = bool + import_routes = bool + } +``` + +If you added the variable after applying, simply apply Terraform again. + +### Export routes via gcloud + +The peering has a name like `gke-xxxxxxxxxxxxxxxxxxxx-xxxx-xxxx-peer`, you can edit it in the Cloud Console from the *VPC network peering* page or using `gcloud`: ``` gcloud compute networks peerings list