diff --git a/examples/terraform-submodules/gke/module.tf b/examples/terraform-submodules/gke/module.tf index f403e980a6..677ecfbca1 100644 --- a/examples/terraform-submodules/gke/module.tf +++ b/examples/terraform-submodules/gke/module.tf @@ -14,7 +14,7 @@ // Run: -// terraform apply -var project="" [-var agones_version="1.4.0"] +// terraform apply -var project="" [-var agones_version="1.8.0"] provider "google" { version = "~> 2.10" @@ -56,6 +56,11 @@ variable "network" { description = "The name of the VPC network to attach the cluster and firewall rule to" } +variable "subnetwork" { + default = "" + description = "The subnetwork to host the cluster in. Required field if network value isn't 'default'." +} + variable "log_level" { default = "info" } @@ -66,8 +71,8 @@ variable "feature_gates" { module "gke_cluster" { // *************************************************************************************************** - // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.3.0 corresponds - // to Agones version 1.3.0 + // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.8.0 corresponds + // to Agones version 1.8.0 // *************************************************************************************************** source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/gke/?ref=master" @@ -78,13 +83,14 @@ module "gke_cluster" { "initialNodeCount" = var.node_count "project" = var.project "network" = var.network + "subnetwork" = var.subnetwork } } module "helm_agones" { // *************************************************************************************************** - // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.3.0 corresponds - // to Agones version 1.3.0 + // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.8.0 corresponds + // to Agones version 1.8.0 // *************************************************************************************************** source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=master" diff --git a/site/content/en/docs/Installation/Terraform/gke.md b/site/content/en/docs/Installation/Terraform/gke.md index 1dd525f9c3..1986877efa 100644 --- a/site/content/en/docs/Installation/Terraform/gke.md +++ b/site/content/en/docs/Installation/Terraform/gke.md @@ -88,6 +88,9 @@ Configurable parameters: - zone - the name of the [zone](https://cloud.google.com/compute/docs/regions-zones) you want your cluster to be created in (default is "us-west1-c") - network - the name of the VPC network you want your cluster and firewall rules to be connected to (default is "default") +{{% feature publishVersion="1.9.0" %}} +- subnetwork - the name of the subnetwork in which the cluster's instances are launched. (required when using non default network) +{{% /feature %}} - log_level - possible values: Fatal, Error, Warn, Info, Debug (default is "info") - feature_gates - a list of alpha and beta version features to enable. For example, "PlayerTracking=true&ContainerPortAllocation=true" - gameserver_minPort - the lower bound of the port range which gameservers will listen on (default is "7000") @@ -118,12 +121,30 @@ Next, make sure that you can authenticate using gcloud: ``` gcloud auth application-default login ``` - +{{% feature expiryVersion="1.9.0" %}} Now you can create your GKE cluster (optionally specifying the version of Agones you want to use): ``` -terraform apply -var project="" [-var agones_version="1.0.0"] +terraform apply -var project="" +``` +{{% /feature %}} + +{{% feature publishVersion="1.9.0" %}} +#### Option 1: Creating the cluster in the default VPC +To create your GKE cluster in the default VPC just specify the project variable. + +``` +terraform apply -var project="" ``` +#### Option 2: Creating the cluster in a custom VPC +To create the cluster in a custom VPC you must specify the project, network and subnetwork variables. + +``` +terraform apply -var project="" -var network="" -var subnetwork="" +``` +{{% /feature %}} + + To verify that the cluster was created successfully, set up your kubectl credentials: ``` gcloud container clusters get-credentials --zone us-west1-c agones-terraform-example