Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

edited modules in main #9

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .terraform/modules/modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"gke","Source":"registry.terraform.io/terraform-google-modules/kubernetes-engine/google","Version":"30.0.0","Dir":".terraform/modules/gke"}]}
80 changes: 80 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
project_id = var.gcp_project_id
name = var.gke_cluster_name
region = var.gcp_region
regional = var.gke_regional
zones = var.gke_zones
network = var.gke_network
subnetwork = var.gke_subnetwork
http_load_balancing = false
network_policy = false
horizontal_pod_autoscaling = true
filestore_csi_driver = false
ip_range_services = "europe-west1-01-gke-01-services"
ip_range_pods = "europe-west1-01-gke-01-pods"
node_pools = [
{
name = var.gke_default_nodepools_name
machine_type = "e2-medium"
min_count = 1
max_count = 3
local_ssd_count = 0
spot = false
disk_size_gb = 100
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
enable_gcfs = false
enable_gvnic = false
logging_variant = "DEFAULT"
auto_repair = true
auto_upgrade = true
service_account = var.gke_service_account_name
preemptible = true # Only in test not in production
initial_node_count = 1
},
]

node_pools_oauth_scopes = {
all = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}

node_pools_labels = {
all = {}

default-node-pool = {
default-node-pool = true
}
}

node_pools_metadata = {
all = {}

default-node-pool = {
node-pool-metadata-custom-value = "my-node-pool"
}
}

node_pools_taints = {
all = []

default-node-pool = [
{
key = "default-node-pool"
value = true
effect = "PREFER_NO_SCHEDULE"
},
]
}

node_pools_tags = {
all = []

default-node-pool = [
"default-node-pool",
]
}
}
8 changes: 8 additions & 0 deletions providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ provider "google" {
credentials = file(var.gcp_credentials)
project = var.gcp_project_id
region = var.gcp_region
}

data "google_client_config" "default" {}

provider "kubernetes" {
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)
}
10 changes: 10 additions & 0 deletions variables.auto.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
gcp_credentials = "token.json"
gcp_project_id = "deploying-with-terraform"
gcp_region= "europe_west3"
gke_cluster_name = "template-to-cluster"
gke_zones = ["europe-west3-b"]
gke_regional = false
gke_network = "default"
gke_subnetwork = "default"
gke_default_nodepools_name = "nodes_pool"
gke_service_account_name = "serviceAccount:[email protected]"
35 changes: 35 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,39 @@ variable "gcp_project_id" {
variable "gcp_region" {
type = string
description = "GCP region"
}

variable "gke_cluster_name" {
type = string
description = "GCP cluster name"
}

variable "gke_zones" {
type = list(string)
description = "List of zones for the GKE cluster"
}

variable "gke_regional" {
type = bool
description = "regional choice"
}

variable "gke_network" {
type = string
description = "VPC network name"
}

variable "gke_subnetwork" {
type = string
description = "VPC subnetwork name"
}

variable "gke_default_nodepools_name" {
type = string
description = "default name for node pool"
}

variable "gke_service_account_name" {
type = string
description = "Service account name"
}
3 changes: 0 additions & 3 deletions variables.tfvars

This file was deleted.

Loading