Skip to content
Snippets Groups Projects
Commit fb6c31bf authored by Viktor Nagy's avatar Viktor Nagy
Browse files

Move variables to variables.tf

parent 792de803
No related branches found
No related tags found
No related merge requests found
// Configure the Google Cloud resources
provider "google" {
project = "gcp-project" // Override to use your GCP project
region = "us-central1" // Override to use your preferred regtion
zone = "us-central1-c" // Override to use your preferred zone
project = var.gcp_project
}
resource "google_container_cluster" "primary" {
name = "iac-demo-gke" // Override to your preferred cluster name
name = var.cluster_name
location = var.gcp_region
remove_default_node_pool = true
initial_node_count = 1
min_master_version = "1.19"
description = var.description
}
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
name = "${var.cluster-name} - node-pool"
cluster = google_container_cluster.primary.name
location = var.gcp_region
node_count = 3
node_config {
preemptible = true
machine_type = "n1-standard-4"
machine_type = var.machine_type
metadata = {
disable-legacy-endpoints = "true"
......@@ -31,7 +31,3 @@ resource "google_container_node_pool" "primary_preemptible_nodes" {
]
}
}
output "env-dynamic-url" {
value = "https://${google_container_cluster.primary.endpoint}"
}
output "env-dynamic-url" {
value = "https://${google_container_cluster.primary.endpoint}"
}
variable "gcp_project" {
type = string
default = "gcp-project"
description = "The name of the Google Cloud Project where the cluster is to be provisioned"
}
variable "gcp_region" {
type = string
default = "us-central1"
description = "The name of the Google region where the cluster nodes are to be provisioned"
}
variable "cluster_name" {
type = string
default = "GitLab group level cluster"
description = "The name of the cluster to appear on the Google Cloud Console"
}
variable "machine_type" {
type = string
default = "n1-standard-4"
description = "The name of the machine type to use for the cluster nodes"
}
variable "cluster_description" {
type = string
default = "This cluster is defined in GitLab"
description = "A description for the cluster. We recommend adding the \$CI_PROJECT_URL variable to describe where the cluster is configured."
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment