agones.dev/agones@v1.53.0/build/terraform/gke-autopilot/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 apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.17.0"]
    18  
    19  terraform {
    20    required_version = ">= 1.0.0"
    21    required_providers {
    22      google = {
    23        source  = "hashicorp/google"
    24        version = "~> 4.25.0"
    25      }
    26    }
    27  }
    28  
    29  /////////////////////
    30  // Cluster parameters
    31  
    32  variable "name" {
    33    default = "agones-tf-cluster"
    34  }
    35  
    36  variable "project" {
    37    default = ""
    38  }
    39  
    40  variable "location" {
    41    default     = "us-west1"
    42    description = "The GCP location to create the cluster in"
    43  }
    44  
    45  variable "network" {
    46    default     = "default"
    47    description = "The name of the VPC network to attach the cluster and firewall rule to"
    48  }
    49  
    50  ////////////////////
    51  // Agones parameters
    52  
    53  // Install latest version of agones
    54  variable "agones_version" {
    55    default = ""
    56  }
    57  
    58  variable "values_file" {
    59    default = "../../../install/helm/agones/values.yaml"
    60  }
    61  
    62  variable "chart" {
    63    default = "agones"
    64  }
    65  
    66  variable "crd_cleanup" {
    67    default = "true"
    68  }
    69  
    70  variable "ping_service_type" {
    71    default = "LoadBalancer"
    72  }
    73  
    74  variable "pull_policy" {
    75    default = "Always"
    76  }
    77  
    78  variable "image_registry" {
    79    default = "us-docker.pkg.dev/agones-images/release"
    80  }
    81  
    82  variable "always_pull_sidecar" {
    83    default = "true"
    84  }
    85  
    86  variable "image_pull_secret" {
    87    default = ""
    88  }
    89  
    90  variable "log_level" {
    91    default = "info"
    92  }
    93  
    94  variable "feature_gates" {
    95    default = ""
    96  }
    97  
    98  module "gke_autopilot_cluster" {
    99    source = "../../../install/terraform/modules/gke-autopilot"
   100  
   101    cluster = {
   102      "name"     = var.name
   103      "project"  = var.project
   104      "location" = var.location
   105      "network"  = var.network
   106    }
   107  }
   108  
   109  module "helm_agones" {
   110    source = "../../../install/terraform/modules/helm3"
   111  
   112    agones_version         = var.agones_version
   113    values_file            = var.values_file
   114    chart                  = var.chart
   115    feature_gates          = var.feature_gates
   116    host                   = module.gke_autopilot_cluster.host
   117    token                  = module.gke_autopilot_cluster.token
   118    cluster_ca_certificate = module.gke_autopilot_cluster.cluster_ca_certificate
   119    image_registry         = var.image_registry
   120    image_pull_secret      = var.image_pull_secret
   121    crd_cleanup            = var.crd_cleanup
   122    ping_service_type      = var.ping_service_type
   123    log_level              = var.log_level
   124  }
   125  
   126  output "host" {
   127    value = module.gke_autopilot_cluster.host
   128  }
   129  output "token" {
   130    value     = module.gke_autopilot_cluster.token
   131    sensitive = true
   132  }
   133  output "cluster_ca_certificate" {
   134    value = module.gke_autopilot_cluster.cluster_ca_certificate
   135  }