agones.dev/agones@v1.54.0/examples/terraform-submodules/eks/module.tf (about) 1 // Copyright 2020 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 apply [-var agones_version="1.17.0"] 18 19 terraform { 20 required_version = ">= 1.0.0" 21 required_providers { 22 aws = { 23 source = "hashicorp/aws" 24 version = "~> 3.0" 25 } 26 } 27 } 28 29 // Install latest version of agones 30 variable "agones_version" { 31 default = "" 32 } 33 34 variable "cluster_name" { 35 default = "agones-cluster" 36 } 37 38 variable "region" { 39 default = "us-west-2" 40 } 41 42 variable "node_count" { 43 default = "4" 44 } 45 46 provider "aws" { 47 region = var.region 48 } 49 50 variable "machine_type" { default = "t2.large" } 51 52 variable "log_level" { 53 default = "info" 54 } 55 56 variable "feature_gates" { 57 default = "" 58 } 59 60 module "eks_cluster" { 61 // *************************************************************************************************** 62 // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds 63 // to Agones version 1.17.0 64 // *************************************************************************************************** 65 source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/eks/?ref=main" 66 67 machine_type = var.machine_type 68 cluster_name = var.cluster_name 69 node_count = var.node_count 70 region = var.region 71 } 72 73 data "aws_eks_cluster_auth" "example" { 74 name = var.cluster_name 75 } 76 77 // Next Helm module cause "terraform destroy" timeout, unless helm release would be deleted first. 78 // Therefore "helm delete --purge agones" should be executed from the CLI before executing "terraform destroy". 79 module "helm_agones" { 80 // *************************************************************************************************** 81 // Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds 82 // to Agones version 1.17.0 83 // *************************************************************************************************** 84 source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=main" 85 86 udp_expose = "false" 87 agones_version = var.agones_version 88 values_file = "" 89 feature_gates = var.feature_gates 90 host = module.eks_cluster.host 91 token = data.aws_eks_cluster_auth.example.token 92 cluster_ca_certificate = module.eks_cluster.cluster_ca_certificate 93 log_level = var.log_level 94 } 95 96 output "host" { 97 value = "${module.eks_cluster.host}" 98 } 99 output "cluster_ca_certificate" { 100 value = "${module.eks_cluster.cluster_ca_certificate}" 101 }