agones.dev/agones@v1.53.0/build/terraform/performance/module.tf (about) 1 // Copyright 2023 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 16 // Run: 17 // terraform init -backend-config="bucket=<YOUR_GCP_ProjectID>-performance-infra-bucket-tfstate" -backend-config="prefix=terraform/state" 18 // terraform apply -var project="<YOUR_GCP_ProjectID>" 19 // The performance test cluster is hosted in project `agones-images`, i.e: 20 // terraform init -backend-config="bucket=agones-images-performance-infra-bucket-tfstate" -backend-config="prefix=terraform/state" 21 // terraform apply -var project="agones-images" 22 23 terraform { 24 required_version = ">= 1.0.0" 25 required_providers { 26 google = { 27 source = "hashicorp/google" 28 version = "~> 4.25.0" 29 } 30 helm = { 31 source = "hashicorp/helm" 32 version = "~> 2.3" 33 } 34 } 35 backend "gcs" { 36 } 37 } 38 39 variable "project" {} 40 variable "kubernetes_versions" { 41 description = "Create performance test clusters with these k8s versions in these regions" 42 type = map(list(string)) 43 default = { 44 "1.32" = ["us-central1", "RAPID"] 45 } 46 } 47 48 module "gke_standard_cluster" { 49 for_each = var.kubernetes_versions 50 source = "../e2e/gke-standard" 51 project = var.project 52 kubernetesVersion = each.key 53 location = each.value[0] 54 overrideName = format("standard-performance-test-cluster-%s", replace(each.key, ".", "-")) 55 releaseChannel = each.value[1] 56 machineType = "e2-standard-4" 57 initialNodeCount = 200 58 } 59 60 resource "google_compute_firewall" "udp" { 61 name = "gke-game-server-firewall" 62 project = var.project 63 network = "default" 64 65 allow { 66 protocol = "udp" 67 ports = ["7000-8000"] 68 } 69 70 target_tags = ["game-server"] 71 source_ranges = ["0.0.0.0/0"] 72 } 73 74 resource "google_compute_firewall" "tcp" { 75 name = "gke-game-server-firewall-tcp" 76 project = var.project 77 network = "default" 78 79 allow { 80 protocol = "tcp" 81 ports = ["7000-8000"] 82 } 83 84 target_tags = ["game-server"] 85 source_ranges = ["0.0.0.0/0"] 86 }