From cb8227954909f0d1adeaa358fc453619aacb212c Mon Sep 17 00:00:00 2001 From: ThomasCardin Date: Fri, 5 Jan 2024 08:39:31 -0500 Subject: [PATCH] issue #1: removed unused cluster node pool --- .gitignore | 3 + .terraform.lock.hcl | 102 ++++++++++++++++++++ backends.tf | 13 --- terraform/dns/provider.tf | 0 terraform/dns/variables.tf | 0 terraform/gcp-kubernetes-cluster/cluster.tf | 40 +------- 6 files changed, 110 insertions(+), 48 deletions(-) create mode 100644 .terraform.lock.hcl delete mode 100644 backends.tf delete mode 100644 terraform/dns/provider.tf delete mode 100644 terraform/dns/variables.tf diff --git a/.gitignore b/.gitignore index 9b8a46e6..d23a2192 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ override.tf.json # Ignore CLI configuration files .terraformrc terraform.rc + +# jq (used to gather information when terraform applying or plannig) +jq diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 00000000..8e7f85cc --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,102 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/external" { + version = "2.3.1" + constraints = "2.3.1" + hashes = [ + "h1:bROCw6g5D/3fFnWeJ01L4IrdnJl1ILU8DGDgXCtYzaY=", + "zh:001e2886dc81fc98cf17cf34c0d53cb2dae1e869464792576e11b0f34ee92f54", + "zh:2eeac58dd75b1abdf91945ac4284c9ccb2bfb17fa9bdb5f5d408148ff553b3ee", + "zh:2fc39079ba61411a737df2908942e6970cb67ed2f4fb19090cd44ce2082903dd", + "zh:472a71c624952cff7aa98a7b967f6c7bb53153dbd2b8f356ceb286e6743bb4e2", + "zh:4cff06d31272aac8bc35e9b7faec42cf4554cbcbae1092eaab6ab7f643c215d9", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:7ed16ccd2049fa089616b98c0bd57219f407958f318f3c697843e2397ddf70df", + "zh:842696362c92bf2645eb85c739410fd51376be6c488733efae44f4ce688da50e", + "zh:8985129f2eccfd7f1841ce06f3bf2bbede6352ec9e9f926fbaa6b1a05313b326", + "zh:a5f0602d8ec991a5411ef42f872aa90f6347e93886ce67905c53cfea37278e05", + "zh:bf4ab82cbe5256dcef16949973bf6aa1a98c2c73a98d6a44ee7bc40809d002b8", + "zh:e70770be62aa70198fa899526d671643ff99eecf265bf1a50e798fc3480bd417", + ] +} + +provider "registry.terraform.io/hashicorp/google" { + version = "5.10.0" + constraints = "~> 5.0" + hashes = [ + "h1:3kD/GqYmZkA97ebToXu6qhhrwo+GQNmqq9xv30Qkhmw=", + "zh:0f6a1feb5b3a128be6ef5fe0400ed800310a67e799c18aec7442161bb6d3ba36", + "zh:13d591ba78e424c94ce5caaf176ab6b087b0e3af08a7b6bcd963673698cdefda", + "zh:3bef54a2b24b06eef99f3df02e0fe4ac97f018c89f83e0faeb4ade921962565b", + "zh:3f3755b8f5b9db1611d42a02c21f03c54577e4aad3cf93323792f131c671c050", + "zh:61516eec734714ac48b565bee93cc2532160d1b4bd0320753799b829083b7060", + "zh:9160848ad0b9becb522a0744dcb89474849906aa2436ed945c658fe201a724b0", + "zh:aa5e79b01949cfedd874bf52958f90cf8f7d202600126c872127a9a156a3c17b", + "zh:cef73a67031008b7d7ef3edfbcd5e1a9b04c0f2580d815401248025b741bc8e4", + "zh:d2ad21ff9e9d2ad04146591c1b5784075e6df73e2bd243efd8d227d764b80b6e", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "zh:f58b145081d20bce52e14bee0de73f5c018bc39b8c4736e23e1329df32f8bd45", + "zh:fb82f6b5d1f992243ab8fe417659cdf9831202cf1e16fe7593d3967888b035cc", + ] +} + +provider "registry.terraform.io/hashicorp/kubernetes" { + version = "2.24.0" + constraints = "2.24.0" + hashes = [ + "h1:u9lRMCdNXcB5/WQTZVMvGhNliW2pKOzj3SOVbu9yPpg=", + "zh:0ed83ec390a7e75c4990ebce698f14234de2b6204ed9a01cd042bb7ea5f26564", + "zh:195150e4fdab259c70088528006f4604557a051e037ebe8de64e92840f27e40a", + "zh:1a334af55f7a74adf033eb871c9fe7e9e648b41ab84321114ef4ca0e7a34fba6", + "zh:1ef68c3832691de21a61bf1a4e268123f3e08850712eda0b893cac908a0d1bc1", + "zh:44a1c58e5a6646e62b0bad653319c245f3b635dd03554dea2707a38f553e4a52", + "zh:54b5b374c4386f7f05b3fe986f9cb57bde4beab3bdf6ee33444f2b9a81b8af64", + "zh:aa8c2687ab784b72f8cdad8d3c3673dea83b33561e7b3f2d287ef0d06ff2a9e5", + "zh:e6ecba0503052ef3ad49ad56e17b2a73d9b55e30fcb82b040189d281e25e1a3b", + "zh:f105393f6487d3eb1f1636ba42d10c82950ddfef852244c1bca8d526fa23a9a3", + "zh:f17a8f1914ec66d80ccacecd40123362cf093abee3d3aa1ff9f8f687d8736f85", + "zh:f394b12ef01fa0bdf666a43ad152eb3890134f35e635ea056b18771c292de46e", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + ] +} + +provider "registry.terraform.io/hashicorp/local" { + version = "2.4.0" + constraints = "2.4.0" + hashes = [ + "h1:R97FTYETo88sT2VHfMgkPU3lzCsZLunPftjSI5vfKe8=", + "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", + "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", + "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", + "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", + "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", + "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", + "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", + "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", + "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", + "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", + ] +} + +provider "registry.terraform.io/hashicorp/tls" { + version = "4.0.4" + constraints = "4.0.4" + hashes = [ + "h1:pe9vq86dZZKCm+8k1RhzARwENslF3SXb9ErHbQfgjXU=", + "zh:23671ed83e1fcf79745534841e10291bbf34046b27d6e68a5d0aab77206f4a55", + "zh:45292421211ffd9e8e3eb3655677700e3c5047f71d8f7650d2ce30242335f848", + "zh:59fedb519f4433c0fdb1d58b27c210b27415fddd0cd73c5312530b4309c088be", + "zh:5a8eec2409a9ff7cd0758a9d818c74bcba92a240e6c5e54b99df68fff312bbd5", + "zh:5e6a4b39f3171f53292ab88058a59e64825f2b842760a4869e64dc1dc093d1fe", + "zh:810547d0bf9311d21c81cc306126d3547e7bd3f194fc295836acf164b9f8424e", + "zh:824a5f3617624243bed0259d7dd37d76017097dc3193dac669be342b90b2ab48", + "zh:9361ccc7048be5dcbc2fafe2d8216939765b3160bd52734f7a9fd917a39ecbd8", + "zh:aa02ea625aaf672e649296bce7580f62d724268189fe9ad7c1b36bb0fa12fa60", + "zh:c71b4cd40d6ec7815dfeefd57d88bc592c0c42f5e5858dcc88245d371b4b8b1e", + "zh:dabcd52f36b43d250a3d71ad7abfa07b5622c69068d989e60b79b2bb4f220316", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + ] +} diff --git a/backends.tf b/backends.tf deleted file mode 100644 index 582fc53e..00000000 --- a/backends.tf +++ /dev/null @@ -1,13 +0,0 @@ -terraform { - backend "gcs" { - bucket = "terraform-tfstate-gcp-storage" - prefix = "terraform/state" - } - - required_providers { - google = { - source = "hashicorp/google" - version = "~> 5.0" - } - } -} \ No newline at end of file diff --git a/terraform/dns/provider.tf b/terraform/dns/provider.tf deleted file mode 100644 index e69de29b..00000000 diff --git a/terraform/dns/variables.tf b/terraform/dns/variables.tf deleted file mode 100644 index e69de29b..00000000 diff --git a/terraform/gcp-kubernetes-cluster/cluster.tf b/terraform/gcp-kubernetes-cluster/cluster.tf index 1dc3ed78..c2c39c7c 100644 --- a/terraform/gcp-kubernetes-cluster/cluster.tf +++ b/terraform/gcp-kubernetes-cluster/cluster.tf @@ -68,47 +68,17 @@ resource "google_container_node_pool" "nodepool" { auto_upgrade = true } - node_config { - preemptible = false - machine_type = "e2-small" - - labels = { - role = "general" - } - - service_account = google_service_account.kubernetes.email - oauth_scopes = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - } -} - -resource "google_container_node_pool" "spot" { - name = "${var.cluster_name}-spot-nodepool" - cluster = google_container_cluster.cluster.id - - management { - auto_repair = true - auto_upgrade = true - } - autoscaling { - min_node_count = 0 - max_node_count = 3 + min_node_count = 1 + max_node_count = 10 } node_config { - preemptible = true + preemptible = false machine_type = "e2-small" labels = { - team = "devsecops" - } - - taint { - key = "instance_type" - value = "${var.cluster_name}-spot" - effect = "NO_SCHEDULE" + role = "general" } service_account = google_service_account.kubernetes.email @@ -116,4 +86,4 @@ resource "google_container_node_pool" "spot" { "https://www.googleapis.com/auth/cloud-platform" ] } -} +} \ No newline at end of file